C - Write program to define int type variable


Declare an integer variable my_int and assign it the value 22.

Have a printf() statement display the variable's value.

Have a second printf() statement display that value plus 16.

Then have a third printf() statement that displays the value of my_int multiplied by itself.


#include <stdio.h>

int main()//from  w w  w.ja v  a2s . c o m
    int my_int;

    my_int = 22;

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


Related Exercise