Answer to Question #49477 in C++ for AJ Cabredo

Question #49477
Help Please..!! C++ program that print a pattern..

**********
-********-
--******--
---****---
----**---

Only three to four for loops or it is okay if there is an if else statement..
1
Expert's answer
2014-11-28T01:11:06-0500
#include <iostream>
using namespace std;
int main()
{
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < i; j++)
cout << "_";
for(int j = 0; j < 2*(5 - i); j++)
cout << "*";
for(int j = 0; j < i; j++)
cout << "_";
cout << endl;
}
cin.get();
cin.get();
}


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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS