0
printf("seu consumo e:%.2f \n", &calc);
// omite & para valor ^ assim é endereço de memória
The correct form is
printf("seu consumo e:%.2f \n", calc);
0
0
printf("seu consumo e:%.2f \n", &calc);
// omite & para valor ^ assim é endereço de memória
The correct form is
printf("seu consumo e:%.2f \n", calc);
0
Don’t forget to initialize the variable
When you print the variable do not need to put its memory address
#include <stdio.h>
int main()
{
float calc = 0, kwh;
printf("Escreva seu consumo em kwh: ");
scanf("%f", &kwh);
calc = kwh * 0.2;
printf("Seu consumo e: %.2f \n", calc);
return 0;
}
thanks dude I solved.
Browser other questions tagged c
You are not signed in. Login or sign up in order to post.
Note that to make calculations with non-integer values the type of being float or double.
– lsalamon
Avoid posting images with your code - paste the code itself, using the website’s formatting features.
– jsbueno