#include <stdio.h>
#include <conio.h>
void main ()
{
char name[25];
int choice;
float cahrge1,charge2,charge3,charge4,charge5,unit1,unit2,unit3,unit4,unit5;
printf ("\n enter name of user:");
scanf ("%s", name);
printf ("\n you can perform following operation:");
printf ("\n 1. below 83.33:");
printf ("\n 2. above 83.34 to 100:");
printf ("\n 3. above 100 to 200:");
printf ("\n 4. above 200 to 300:");
printf ("\n 5. above 300:");
printf ("\n enter your choice:"):
scanf ("%d", &choice);
switch ( choice )
{
case 1:
printf ("\n enter value of units:");
scanf ("%d", &unit1);
printf ("\n Energy charge is 50:");
break;
case 2:
printf ("\n enter value of units:");
scanf ("%d", &unit2);
charge2= 0.6*unit2;
printf ("\n Charge=%d",charge2);
break;
case 3:
printf ("\n enter value of units:");
scanf ("%d", &unit3);
charge3=( 0.8*(unit3-100)+60;
printf ("\n Charge=%d",charge3);
break;
scanf ("%d", &unit4);
charge4=( 0.9*(unit4-200)+140);
printf ("\n Charge=%d",charge4);
break;
scanf ("%d", &unit5);
charge5=( 0.9*(unit5-300)+230);
charge5=charge5+0.15*(charge5);
printf ("\n Charge=%d",charge5);
break;
default:
printf ("\n Have a nice day:");
}
getch ();
}
#include <conio.h>
void main ()
{
char name[25];
int choice;
float cahrge1,charge2,charge3,charge4,charge5,unit1,unit2,unit3,unit4,unit5;
printf ("\n enter name of user:");
scanf ("%s", name);
printf ("\n you can perform following operation:");
printf ("\n 1. below 83.33:");
printf ("\n 2. above 83.34 to 100:");
printf ("\n 3. above 100 to 200:");
printf ("\n 4. above 200 to 300:");
printf ("\n 5. above 300:");
printf ("\n enter your choice:"):
scanf ("%d", &choice);
switch ( choice )
{
case 1:
printf ("\n enter value of units:");
scanf ("%d", &unit1);
printf ("\n Energy charge is 50:");
break;
case 2:
printf ("\n enter value of units:");
scanf ("%d", &unit2);
charge2= 0.6*unit2;
printf ("\n Charge=%d",charge2);
break;
case 3:
printf ("\n enter value of units:");
scanf ("%d", &unit3);
charge3=( 0.8*(unit3-100)+60;
printf ("\n Charge=%d",charge3);
break;
case 4:
printf ("\n enter value of units:");scanf ("%d", &unit4);
charge4=( 0.9*(unit4-200)+140);
printf ("\n Charge=%d",charge4);
break;
case 5:
printf ("\n enter value of units:");scanf ("%d", &unit5);
charge5=( 0.9*(unit5-300)+230);
charge5=charge5+0.15*(charge5);
printf ("\n Charge=%d",charge5);
break;
default:
printf ("\n Have a nice day:");
}
getch ();
}
That's pretty cool. I bet it's useful for some.
ReplyDeleteIm not smart enough to understand this.
ReplyDeleteThis is really helps to all of programmers
ReplyDeleteGreat job!
ReplyDeleteOMG my brother will be thrilled to learn this code!
ReplyDeleteLooking for the best generator? Consumer Reports has honest ratings and reviews on generatorsfrom the unbiased experts you can trust. Going Here
ReplyDeletethank you for sharing
ReplyDeleteobviously like your web-site Post Thanks for Shearing. i Read your Blog every day.it very bothersome to tell the reality then again I’ll definitely come back again.Please write more about this topics.
ReplyDeleteMore