Taking inputs in c programming|| Simple C Program: Get User Input and Display the Chosen Digit

#include <stdio.h>

int main() {
    // Declare a variable to store the user's input
    int a;

    // Prompt the user to enter a digit
    printf("Enter a digit: \n");

    // Read the input from the user and store it in the variable 'a'
    scanf("%d", &a);

    // Display the chosen digit to the user
    printf("You chose %d", a);

    // Return 0 to indicate successful program execution
    return 0;
}

Comments

Popular posts from this blog

Weird Algorithm || Introductory Problem || CSES