* * * * * * * * * * | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

* * * * * * * * * *

how to print this pattern using while loop in python

3rd Oct 2016, 6:02 PM
Anju kv
Anju kv - avatar
5 Answers
+ 3
try it with the following code: # input: number of rows n = int(input()) i = 0 while i < n: print(i * '* ') i = i+1
3rd Oct 2016, 8:16 PM
Amarie
0
//easy as a for cycle string sym1="*"; string sym2=" "; for (int i=1; i<=10; i++) cout << sym1 << sym2; //if someone know why i cannot use char instead of string please answer to me :)
3rd Oct 2016, 6:15 PM
Ernesto Salvetti
Ernesto Salvetti - avatar
0
how to solve this with while loop
3rd Oct 2016, 6:26 PM
Anju kv
Anju kv - avatar
0
can we do this using two while loops
4th Oct 2016, 12:45 PM
Anju kv
Anju kv - avatar
- 1
//easy as a while (you know is the same thing written different) int i=1; string sym1="*"; string sym2=" "; while (i<=10) { cout << sym1 << sym2; i++; }
3rd Oct 2016, 6:30 PM
Ernesto Salvetti
Ernesto Salvetti - avatar