C++ Program to print integer

Simple C++ program to print an integer.
#include<iostream>
using namespace std;
int main()
{
 int n=4;
 cout<<"Integer = "<<n<<endl;
 return 0;
}
Another C++ program to get input from keyboard and print
#include<iostream>
using namespace std;
int main()
{
 int n;
 cout<<"Enter integer: ";
 cin>>n;
 cout<<"Integer = "<<n<<endl;
 return 0;
}
C++ program to print integer using function
#include<iostream>
using namespace std;
void PrintInteger()
{
 int n;
 cout<<"Enter integer: ";
 cin>>n;
 cout<<"Integer= "<<n;
}
int main()
{
 PrintInteger();
 return 0;
}


Popular posts from this blog