English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Use" for" loops to construct a program that displays a pyramid of numbers on the screen.
The pyramid should look like this:

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

Ask the user to enter a digit(0-9) and display the pyramid with limit up to that number( as shown above).
#include
main()
{
int i,n,j;
cout<<"please enter number: ";
cin>>n;
for ( i = 1; i <= n; i++)
{
for ( j = 0; j < n - i + 2; j++)
cout<<(' ');
for ( j = 0; j < i; j++)
{
cout<<(i);
cout<<(' ');
}
cout<<"\n";
}
}

2006-10-27 02:09:10 · 2 answers · asked by Muhammad A 1 in Computers & Internet Programming & Design

2 answers

It would be a learning experience for you if you could develop your own desired flowchart, then other (includes me) people could review, comment, advise your work. You can do it!

2006-10-27 02:22:52 · answer #1 · answered by Anonymous · 0 0

And you can do it without Visio....there are flowcharting symbols in Word.....

It's good for you....

2006-10-28 10:50:03 · answer #2 · answered by Kaia 7 · 0 0

fedest.com, questions and answers