Program to print electricity bill by unit

Program to print electricity bill by unit 

#include<stdio.h>
void main()
{
  int unit1,unit2,cons,a;
  printf("Enter last unit : ");
  scanf("%d",&unit1);

 printf("Enter curret unit : ");
 scanf("%d",&unit2);
 a=unit2-unit1;
 if(a<100) {
  cons=a*6;
 printf("your electricity Bill payment is: %d Rs\n",cons);
 }
 else
       if(a<200)  {
      cons=a*7 ;
   printf("your electricity Bill payment is: %dRs\n",cons);
   }
      else
              if (a<=300){
 cons=a*8;
printf("your electricity Bill payment is: %d Rs \n",cons);
}
 else
    if(a>300)  {
  cons=a*10;
  printf("your electricity Bill payment is: %d Rs \n",cons);
 }
printf("current unit is : %d\n",a);
printf("Pay Now\n");

}

out put:-

No comments:

hia friends you are seeing my blogger thank's. Powered by Blogger.