+ 2

How to display * ** *** **** *****

Pattern is increasing from the right side.

6th Sep 2016, 5:06 PM
mukul joshi
2 Antworten
+ 2
int i, j; for (i = 1; i <= 5; i++) { for (j = 1; j <= 5-i; j++) { cout << " "; } for (; j <= 5; j++) { cout << "*"; } cout << endl; }
6th Sep 2016, 7:07 PM
Zen
Zen - avatar
+ 1
for (i = 0;i < 5; i++){ for (j = 4; j > i; j--) cout << ' '; for (k = j; k > 0; k--) cout << *; } Works
6th Sep 2016, 7:03 PM
Guilherme Medeiros
Guilherme Medeiros - avatar