In this tutorial you will learn about the C++ Program to Print Integer and its application with practical example.
C++ Program to Print Integer
In this tutorial, we will learn to create a C++ program that will Print Integer in C++ programming.
Prerequisites
Before starting with this tutorial we assume that you are best aware of the following C++ programming topics:
- Operators in C++ Programming.
- Basic Input and Output function in C++ Programming.
- Basic C++ Programming.
What is an integer?
The integer is a positive or negative whole number including zero. These are the number real numbers.
Algorithm to print the Integer:-
1 2 3 4 5 6 7 |
1. Declaring the variables for the program. 2. Taking the input from the user in integer format. 3. Printing the data taken in input from the user in number format. 4. End program. |
Program to Print Integer
As we all know the integer, float, or double value in c++ programming. In c++ programming, we can take the input from the user in number format. In this program, we will take input in integer format. The second will display the integer with the help of a small program. The integer are the most useful terminology in any programing language. For number/arithmetic manipulation in c++ programming, there are many predefined functions available.
Integers are the most useful data types in any programming language. The integer values are used with operators to perform the best operations in programming.
With the help of this program, we can take input and Print Integer.
Program to Print Integer:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
/* C++ Program to Print <strong>Integer</strong> */ #include<iostream> using namespace std; int main() { /* variable definition and initialization for the program */ //no will store the <strong>Integer </strong>value for the program int no; // take input from end-user cout << "Enter an Integer: "; cin >> no; /* Printing the output for the <strong>Integer </strong>defined in to a variable in the program with out taking input from the user */ cout << "Entered Integer is: " << no << endl; return 0; } |
Output:-
In the above program, we have first initialized the required variable.
- no = it will hold the input number value from the user.
Taking Input from the user.
Printing the data in the output in the number format.