attempt to display an electricity bill that looks, for example, like this:
*********************************
Present meter reading 6015
previous meter reading 5899
Units used 116
Rate per unit 6.73 pence
Standing charge £7.78
The sum due is £15.59
*********************************
This program displays an electricity bill, given a present meter reading and a previous meter reading. The price per unit (in pence) and a fixed standing charge are constant. The units used and the sum due are to be calculated.
/* Electricity Bill 1 */
#include <stdio.h>
main ()
{
int present, previous;
printf("Type present and previous meter readings:\n");
scanf("%i%i", &present, &previous);
printf("****************************\n");
printf("Present meter reading %i\n", present);
printf("Previous meter reading %i\n", previous);
printf("Units Used %i\n", present-previous);
printf("Rate per unit 6.73 pence\n");
printf("Standing charge £7.78\n\n");
printf("%f\n", (present-previous)*6.73/100 + 7.78);
printf("****************************\n");
getch();
return 0;
}
the problem iam now facing is that i now want the standing charge and the rate per unit to be variable not fixed, in other words i want the program after running it to prompt me to enter the standing charge and the rate per unit.