In this tutorial, we will discuss a simple concept of Write a Cpp program to print an integer
In this program, we are going to learn about how to print an integer number entered by the user in Cpp programming language
The value is stored in a variable num using cin and is displayed on the screen using cout statements
Program 1
#include <iostream> using namespace std; int main() { int num;//variable declaration cout << "Enter an integer" << endl; cin>>num; cout<<"You entered :"<<num; return 0; }
When the above code is executed, it produces the following results
Enter an integer 65 you entered : 65
In the Java program, the user can enter a value using cin and that value stored in a variable named as num. then prints that value using display statements(cout) in C++ language
In this program, cout provide a piece of information to the user for entering an integer value
cout << "Enter an integer" << endl;
The cin reads an input data from the user and stores in variable num
cin>>num;
Finally, the value stored in the variable num is displayed on the screen using cout
cout<<"You entered :"<<num;
Recommended post
Write a C program to print an integer
Write a Java program to print an integer
Write a Python program to print an integer
Suggested for you
PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…
PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…
5 methods to add two numbers in Java In this tutorial, we will discuss the…
Python full Pyramid star pattern program In this tutorial, we will discuss the concept of…
Write a function or method to convert C into F -Entered by the user In…
How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…