I'm making a program that calculates the sales of electrical energy but it is not working properly! can someone help me? this work is for tomorrow! grateful.
# include
# include <stdlib.h>
int main () {
int CC, consumption;
float rate, VF, I, VP;
printf ("Enter a consumer class, which can take the value 1, 2 or 3 \ n");
scanf ("% d", & CC);
if (CC! = 1 && CC! && CC = 2! = 3) {
printf ("ERROR! \ n");
system ("PAUSE");
return (1);}
if (CC == 1) {
rate = 0.5;}
if (CC == 2) {
rate = 0.8;}
if (CC == 3) {
rate = 1.0;}
printf ("Enter how many KWH were consumed \ n");
scanf ("% d, & consumption");
* VF = consumption*rate;
I = 0.3 * FV;
VP = VF + I;
printf ("The amount payable is:% f", VP);
system ("PAUSE");
return (0);
}
'm not getting the right answer! put wrong here ... actually the right is
# include <stdio.h
# include <stdlib.h>
int main () {
int CC, consumption;
float rate, VF, I, VP;
printf ("Enter a consumer class, which can take the value 1, 2 or 3 \n");
scanf ("% d", & CC);
if (CC! = 1 && CC!= 2 && CC!=3) {
printf ("ERROR! \n");
system ("PAUSE");
return (1);}
if (CC == 1) {
rate = 0.5;}
if (CC == 2) {
rate = 0.8;}
if (CC == 3) {
rate = 1.0;}
printf ("Enter how many KWH were consumed \n");
scanf ("% d, & consumption");
VF = consumption*rate;
I = 0.3 * VF;
VP = VF + I;
printf ("The amount payable is:% f", VP);
system ("PAUSE");
return (0);