#include
int main()
{
printf(\"how old are you? \");
int age = 0;
scanf(\"%d\", age);
printf(\"how much does your daily habit co
scanf("%d", daily);
needs to become
scanf("%d", &daily);
You need to pass the address of the variable (i.e., a pointer, this is done with the &
) to scanf
so that the value of the variable can be changed. The same applies for your other prompt. Change it to
scanf("%d", &age);
Now you should get this when you run your program:
% a.out
how old are you? 30
how much does your daily habit cost per day?
20
this year your habit will cost you: 7300.00