Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Write a program that displays the following four (4) grids of numbers using nested loops. Your output should be as follows:

(1)

1
12
123
1234
12345

(2)

1
21
321
4321
54321

(3)

5 6 7 8 9
4 5 6 7 8
3 4 5 6 7
2 3 4 5 6
1 2 3 4 5

(4)

54321
4321
321
21
1
Posted
Updated 1-Dec-13 9:40am
v2
Comments
Maciej Los 1-Dec-13 15:32pm    
[no name] 1-Dec-13 15:37pm    
what is your code?
Crystal-arr 1-Dec-13 15:40pm    
for (i=n; i>=1; i--)
{
for (j=i; j<=9; j++)
{
cout << " " << j;
}
cout << endl;
}
cout <<endl;


for (i=n i>=1; i--)
{
for (j=1; j<=1; i--)
{
cout << j;
}
cout << endl;
}
cout <<endl;




but they are wrong
[no name] 1-Dec-13 16:26pm    
AHHHHH it all makes sense now omg if I don't remember the name of this algorithm I am going to hack something. Ill have some code for you by the end of today. I did this algorithm like 3 months ago and its very simple.
CHill60 1-Dec-13 18:37pm    
Don't do it... look up the story of the guy that opens the crysallis and the butterfly doesn't develop properly :-)

1 solution

You have been give your home assignments just to learn something. If you use someone else's help, you won't use the chance your school gives you. Don't loose your chance — the life is too short to learn enough, and later on, believe me, it would be increasingly difficult to catch up and learn things that you have missed. Don't waste a second, do you home assignments all by yourself.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900