To display a single integer
#include%26lt;iostream.h%26gt;
#include%26lt;conio.h%26gt;
#include%26lt;stdio.h%26gt;
void main
{
int num;
cout%26lt;%26lt;"Enter a integer ";
cin%26gt;%26gt;num;
cout%26lt;%26lt;"\n The integer entered is "%26lt;%26lt;num;
}
To display multiple integers
#include%26lt;iostream.h%26gt;
#include%26lt;conio.h%26gt;
#include%26lt;stdio.h%26gt;
void main
{
int num,i,count;
cout%26lt;%26lt;"Enter the number of integers you want displayed ";
cin%26gt;%26gt;count
for (i=1;i%26lt;=count;i++)
{
cout%26lt;%26lt;"Enter a integer ";
cin%26gt;%26gt;num;
cout%26lt;%26lt;"\n The integer entered is "%26lt;%26lt;num;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment