66 960
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #28609 in C++ for bala

Question #28609
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
Expert's answer
#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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions