• Uncategorized

C++ Program to Print Number Entered by User

With the help of C++ program, compiler can display the number entered by a user. Generally, the compiler takes input from a keyword and displays the output in the monitor or screen. C++ uses cin statement to take input from the user and cout statement to display the result in the screen. Let us look at the C++ example below to print number entered by a user:

C++ Program to Print Number Entered by User

#include <iostream>
using namespace std;
int main() {
   int num;
   cout<<"Enter the number:\n";
   cin>>num;
   cout<<"The number entered by user is: "<<num;
   return 0;
}

The output of the above program is:

Output:

Enter the number: 2
The number entered by user is: 2

 

SHARE C++ Program to Print Number Entered by User

You may also like...


Warning: Undefined array key 0 in /www/wwwroot/followtutorials.com/wp-content/themes/hueman/single.php on line 9

Warning: Attempt to read property "cat_name" on null in /www/wwwroot/followtutorials.com/wp-content/themes/hueman/single.php on line 9

Warning: Undefined array key 0 in /www/wwwroot/followtutorials.com/wp-content/themes/hueman/single.php on line 14

Warning: Attempt to read property "category_parent" on null in /www/wwwroot/followtutorials.com/wp-content/themes/hueman/functions.php on line 37

Warning: Undefined array key 0 in /www/wwwroot/followtutorials.com/wp-content/themes/hueman/single.php on line 15

Warning: Attempt to read property "category_parent" on null in /www/wwwroot/followtutorials.com/wp-content/themes/hueman/single.php on line 15
Share