Get input from user - C Programming



/***************************************************************
 Statement - Get input from user
 Programmer - Vineet Choudhary
 Written For - http://developerinsider.co
 Compiler - gcc
 ***************************************************************/

#include <stdio.h>

int main()
{
    int number;

    printf( "Please enter a number: " );
    scanf( "%d", &number);
    printf( "You entered %d", number );

    return 0;
}

/*
Output

Run1 - 
Please enter a number: 10
You entered 10

Run2 -
Please enter a number: 20
You entered 20
*/

Compilers -

  1. Compile C program with gcc compiler on Bash on Ubuntu on Windows 10
  2. Compile C++ program with g++ compiler on Bash on Ubuntu on Windows 10
  3. Turbo C++
  4. C/C++ Compiler (gcc) for Android - Run C/C++ programs on Android
You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.