Select Menu

Slider

Software's

Transportation

Cement Testing

Inventor

Manual Survey Practical

Quantity Surveying

Videos

» » Electricity Bill Calculation using its number of Units (C-Programming)
«
Next
Newer Post
»
Previous
Older Post



#include<stdio.h>
#include<conio.h>
void main()
{
 int a,a1,a2,a3,am1=0,am2=0,am3=0,am4=0,tot;
 char name[20];
 clrscr();
 printf("enter the customer name and no of units");
 scanf("%s %d",name,&a);
 if(a<=50)
 {
 am1=a*2;
 a1=0;
 }
 else
 {
 am1=50*2;
 a1=a-50;
 }
 if(a1<=100)
 {
 am2=a1*6;
 a2=0;
 }
 else
 {
 am2=100*6;
 a2=a1-100;
 }

 if(a2<=200)
 {
 am3=a2*7;
 }
 else
 {
 am3=200*7;
 a3=a2-200;
 am4=a3*8;
 }


  tot=am1+am2+am3+am4;
  printf("\nThe customer name is %s",name);
  printf("\nNumber of units is %d",a);
  printf("\nTotal amount is %d",tot);
  getch();
  }

«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Post Your Comments