total = num1+num2;
on a line by itself (and terminate the previous line with a semicolon)
this would be a little better
#include
int main(void)
{
int num1 = 62, num2 = 99, total;
total = num1+num2;
printf("%d", total);
return 0;
}
Your problem is that you didn't declare total:
#include
int main(void) {
int num1, num2, total; /* declarations */
num1 = 62;
num2 = 99;
total = num1 + num2; /* 3 assignments */
printf("%d\n", total); /* output */
return 0;
} /* end */
>
> John (gnujohn)
Yea
My task was "Write a program that stores the integers 62, and 99 in a variables, and stores sum in a variable named total?"
This is what I put down:
#include
int main(void)
{
int num1 = 62, num2 = 99, total = num1+num2;
printf("%d", total);
return 0;
}
Thanks.