An interesting C++ program using loops
June 16, 2009 · Print This Article · Email It
In this program, we will code a C++ program which will display a number the number of times the number. Like I type in a number 5 and I will see the number printed 5 times on the VDU and similarly 3 times if my number is 3.
#include<iostream.h>
void main()
{
int a[5];
for(int i=0;i<5;i++)
{
cin>>a[i];
}
for(i=0;i<5;i++)
{
for(int j=0;j<a[i];j++)
{
cout<<a[i];
}
cout<<endl;
}
}




what is interesting in it…..?????
what is interesting in it…..?????