[Tutorial 7] 3. What output might you expect from the following program?
#include <stdio.h>
int main (void)
{
int answer, result;
answer = 100;
result = answer - 10;
printf ("The result is %i\n", result + 5);
return 0;
}
This C program initializes an integer variable `answer` to 100, computes `result` as `answer - 10` resulting in 90, and prints "The result is" followed by the value of `result + 5`, which is 95, using `printf`.
int main (void)
{
int answer, result;
answer = 100;
result = answer - 10;
printf ("The result is %i\n", result + 5);
return 0;
}
Output:
The result is 95
Comments
Post a Comment