C - Write program to Mix variable and constant

Requirements

Create the constant value MY_CONST.

Create int variable my_int.

Add my_int and MY_CONST together.

Output result of my_int times my_int.

Demo

#include <stdio.h>

#define MY_CONST 16/*from ww w  .  j a v a 2  s  . co m*/

int main()
{
    int my_int;

    my_int = 22;

    printf("The value of my_int is %d.\n",my_int);
    printf("The value of my_int plus %d is %d.\n",MY_CONST,my_int+MY_CONST);
    printf("The value of my_int times itself is %d.\n",my_int*my_int);
    return(0);
}

Result

Related Exercise