The person who runs this app is asked to enter a number. When you call the scanf() method, it will take in a value and store it in the number variable. After that, printf() shows the number to the person again. Using scanf() and printf(), this program shows you how to do simple input and output in C.

#include <stdio.h>

int main() {
    int number;
    printf("Enter a number: ");  // Ask the user for input
    scanf("%d", &number);  // Read and store the user's input
    printf("You entered: %d\n", number);  // Display the input back to the user
    return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Verified by MonsterInsights