[Tutorial 7] 1.Write a program that subtracts the value 15 from 87 and displays the result, together with an appropriate message, at the terminal.

#include <stdio.h>
int main(void)
{
int sum;

/* COMPUTE RESULT */
sum = 87 - 15;

/* DISPLAY RESULTS */
printf ("The answer is %i \n", sum);

return 0;
}
This C program calculates the result of subtracting 15 from 87 and then displays the result as "The answer is 72" using the `printf` function.

Output:
The answer is 72

Comments

Popular posts from this blog

Introduction To C

First C Program

Compilation process in c