c
  1. c-program-to-print-an-integer-entered-by-the-user

Program to Print an Integer (Entered by the User) - ( C Programs )

Example

#include <stdio.h>
int main() {
    int num;
    printf("Enter an integer: ");
    scanf("%d", &num);
    printf("The integer is: %d", num);
    return 0;
}

Output

Enter an integer: 123
The integer is: 123

Explanation

This program takes an integer input from the user and prints it on the screen. The user is prompted to enter an integer using the printf() function. The input is stored in the num variable using the scanf() function. Finally, the printf() function is used to display the integer on the screen.

Use

This program can be used to take an integer input from the user and use it for further calculations or display purposes.

Summary

The program takes an integer input from the user and displays it on the screen. It uses the printf() and scanf() functions to take the input and display the output. This program can be useful in various applications where integer inputs are required from users.

Published on: