[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

Compilation process in c

[Tutorial 7] 9.Calculate average marks of 4 subjects which, entered separately.

[Tutorial 7] 10.Convert the given temperature in Celsius to Fahrenheit. T(°F) = T(°C) × 1.8 + 32