To print the pattern | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

To print the pattern

* * * * * * * * * * *

11th Apr 2017, 4:01 PM
Vivek
Vivek - avatar
7 Antworten
+ 3
#include <iostream> using namespace std; int main() { cout << " *\n"; cout << " * *\n"; cout << " * *\n"; cout << "********\n"; }
11th Apr 2017, 4:29 PM
Babak
Babak - avatar
+ 3
test on play ground.
11th Apr 2017, 4:34 PM
Babak
Babak - avatar
+ 3
#include <iostream> using namespace std; int main() { for (int i = 1; i <= 4; ++i) { switch(i) { case 1: cout << " *\n"; break; case 2: cout << " * *\n"; break; case 3: cout << " * *\n"; break; case 4: cout << "* * * * *\n"; break; } } }
11th Apr 2017, 4:53 PM
Babak
Babak - avatar
0
this is not the proper one
11th Apr 2017, 4:32 PM
Vivek
Vivek - avatar
0
this is not the proper way
11th Apr 2017, 4:35 PM
Vivek
Vivek - avatar
0
any one can print by this method
11th Apr 2017, 4:35 PM
Vivek
Vivek - avatar
0
print it by using nesting
11th Apr 2017, 4:35 PM
Vivek
Vivek - avatar