How does C program to print an integer work?

integers


Courtesy: Programiz.com

 In this program, an integer variable number is declared.

int number;

Then, the user is asked to enter an integer number. This number is stored in the number variable.

printf("Enter an integer: ");
scanf("%d", &number);

Finally, the value stored in number is displayed on the screen using printf().

printf("You entered: %d", number);

Comments

Popular posts from this blog

C program to read and display book information using structure

Function prototype and definition

Actual and Formal Parameters