Code:
int GetRates()
{
float fixed, oneup, twoup, threeup;
printf("\nFixed Rate (upto 100KWh.) : ");
scanf("%f",&fixed);
printf("\nRate/KWh. (100 upto 200 KWh.) : ");
scanf("%f",&oneup);
printf("\nRate/KWh (200 upto 300 KWh.) : ");
scanf("%f",&twoup);
printf("\nRate/KWh (above 300 KWh.) : ");
scanf("%f",&threeup);
}
int CalculateBill()
{
float usage,fixed,oneup,twoup,threeup,totalbill,differen
ce;
printf("\nEnter usage in KWh.: ");
scanf("%f",&usage);
while (usage > 0)
You are redefining the variables in each of these functions. You are making them local. You should pass them as parameters, then maybe you will get results. Do you know anything about pointers?
Try
Code:
int getRates (float *fixed, float *oneup, float *twoup, float *threeup)
{
...
}