Saturday, October 15, 2011

A C++ program that use nested loop to print numbers

C++ Program :-



#include<iostream.h>
#include<conio.h>
void main(void)
{
clrscr();
int num1,num2;
for(num1=1;num1<=5;num1++)
{
for(num2=5;num2>=num1;num2--)
{
 cout<<num2;

}
cout<<endl;
}

getch();
}

OUTPUT :-

                The output of this program will be as following.....
54321
5432
543
54
5

Note:- 
        you can make any changes in the output according to your output requirements by simply changing the values in the loop.

2 comments:

  1. Aaahaa .. Yeh PrOgram tO aTa hai MuJhe .. ;)

    ReplyDelete
  2. yar assignment vale be assignment submission karne ka bad upload kar dun ga

    ReplyDelete