[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;
}

Output:

The result is 95

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`.

Comments

Popular posts from this blog

Introduction To C

First C Program

Compilation process in c