0

cpp

to make this shape * ** *** **** ***** we write this code #include<iostream> using namespace std; int main(){ int i; for(int row =1; row<=5; row++){ for (int col=1; col<=row; col++){ cout<<"*";} cout<<"\n";} return 0; } so may anyone explain to me why we wrote col<=row in the inner for .

21st Aug 2019, 3:54 AM
Mahmoud Hamed
Mahmoud Hamed - avatar
1 Respuesta
+ 2
row = 1 * row = 2 ** row = 3 *** row = 4 **** row = 5 ***** You can see that the amount of * is followed by row. And we make a new line(\n) when row increases.
21st Aug 2019, 4:48 AM
你知道規則,我也是
你知道規則,我也是 - avatar