Print#include <iostream>
using namespace std;
int main() {
// outer loop (rows) -> 1 to n
for(int i = 1; i <= 5; i++){
// numbers
for(int j = i; j >= 1; j-- ){
cout << j%2 << " ";
}
cout << endl;
}
return 0;
}
OUTPUT-
1
0 1
1 0 1
0 1 0 1
1 0 1 0 1
No comments:
Post a Comment