#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a,b,m,n,t;
int xy;
cout<<"enter the number of users\n";
cin>>n;
cout<<"enter the charge of meter\n";
cin>>m;
cout<<"1.If the units consumed is 100-199\n";
cout<<"2.If the units consumed is between 200-299\n";
cout<<"3.If the units consumed is =>300\n";
cout<<"enter the choice\n";
cin>>xy;
switch(xy)
{
case 1:
cout<<"enter the electricity consumed in units\n";
cin>>a;
b=a*0.40;
t=b+m/n;
cout<<"the total charge of electricity including meter charge by single user in Rs. will be\n"<<t;
break;
case 2:
cout<<"enter the electricity consumed in units\n";
cin>>a;
b=a*0.50;
t=b+m/n;
cout<<"the total charge of electricity including meter charge by single user in Rs. will be\n"<<t;
break;
case 3:
cout<<"enter the electricity consumed in units\n";
cin>>a;
b=a*0.60;
t=b+m/n;
cout<<"the total charge of electricity including meter charge by single user in Rs. will be\n"<<t;
break;
default:
cout<<"the entered category is invalid";
break;
}
getch();
}
No comments:
Post a Comment