Solution for Exercise 5-14

ex0514

#include <stdio.h>

#define OCTO 8
#define DUO 2

int main()
{
    puts("Values 8 and 2:");
    printf("Addition is %d\n",OCTO+DUO);
    printf("Subtraction is %d\n",OCTO-DUO);
    printf("Multiplication is %d\n",OCTO*DUO);
    printf("Division is %d\n",OCTO/DUO);
    return(0);
}

Notes

* You don't have to use OCTO and DUO as the constants. As long as the output looks the same as for Exercise 5-4, you're good.

* Note that the constants are not used in Line 8, the puts() function. You cannot specify a constant within a string because the compiler expects everything between the double quotes to be text. So:

puts("Values OCTO and DUO:");

displays:

Values OCTO and DUO

The constants are not interpreted by the compiler when they appear in a string.