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//w  ww .j av a 2 s  .  c  o 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