Posted by : Animesh Shaw Wednesday, 4 January 2012


#include<stdio.h>
#include<stdlib.h>
void main()
{
   int cno,pmr,cmr,cu;
   float total;
   char sec;
   char cname[10];
   clrscr();
   printf(" ENTER the SECTOR     : ");
   scanf("%c",&sec);
   printf(" Enter customer name   : ");
   scanf("%s",&cname);
   printf(" Enter customer number  :     ");
   scanf("%d",cno);
   printf(" Enter the previous units  : ");
   scanf("%d",&pmr);
   printf(" Enter the current units  : ");
   scanf("%d",&cmr);
   cu=cmr-pmr;
   if(sec == 'a')
   {
      if(cu>300)
      total=cu*2.00;
if(cu>200  && cu<=300)
total=cu*1.50;
 if(cu>100 && cu<=200)
 total=cu*1.00;
   if(cu<=100)
   total=cu*0.50;
   }
   if(sec=='i')
   {
      if(cu>300)
      total=cu*4.00;
if(cu>200  && cu<=300)
total=cu*3.00;
if(cu>100 && cu<=200)
 total=cu*2.00;
   if(cu<=100)
   total=cu*1.00;
   }
    if(sec == 'a')
   {
      if(cu>300)
      total=cu*2.00;
if(cu>200  && cu<=300)
total=cu*1.50;
 if(cu>100 && cu<=200)
 total=cu*1.00;
   if(cu<=100)
   total=cu*0.50;
   }
    if(sec == 'd')
   {
      if(cu>300)
      total=cu*2.00;
if(cu>200  && cu<=300)
total=cu*1.50;
 if(cu>100 && cu<=200)
 total=cu*1.00;
   if(cu<=100)
   total=cu*0.50;
   }
   printf("\n Customer name   :   %s ",cname);
   printf("\n Customer number :   %d",cno);
   printf("\n Previous Units  :   %d",pmr);
   printf("\n Current Units   :   %d",cmr);
   printf("\n Category        :   %c",sec);
   printf("\n Consumed Units  :   %d",cu);
   printf("\n Electric Bill   :   %f",total);
   getch();
   }

Popular Post

Total Pageviews

Sign In

Follow by Email

Powered by Blogger.

Like Us on Facebook

Search This Blog

Loading...

Indian Coder

- Copyright © Programming Mania -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -