63 067
Assignments Done
99,1%
Successfully Done
In July 2018

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..
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions