Answer to Question #28609 in C++ for bala
Use for loops to construct a program that displays a pyramid of Xs on the screen. The
pyramid should look like this
X
XXX
XXXXX
XXXXXXX
XXXXXXXXX
1
2013-04-17T09:29:13-0400
#include<conio.h>
#include<iostream>
usingnamespace std;
//mainfunction
voidmain(){
//show result
for(int i = 1; i < 10; i+=2) {
cout<< "
";//shownew line
for(int j = 1; j <=i; j++)
cout << "*";// show asterisk
}
getch();//delay
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++
Comments
Leave a comment