+ 2
How to display * ** *** **** *****
Pattern is increasing from the right side.
2 odpowiedzi
+ 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;
}
+ 1
for (i = 0;i < 5; i++){
for (j = 4; j > i; j--)
cout << ' ';
for (k = j; k > 0; k--)
cout << *;
}
Works