How to use nested for loop for a pattern?

What is an example code for a pattern?
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Example program
#include <iostream>

int main()
{
    for (int y = 0; y < 4; y++)
    {
        for (int x = 0; x < 5; x++)
        {
            std::cout << ((x - y < 1) ? 0 : 1);
        }
        std::cout << "\n";
    }
}
Topic archived. No new replies allowed.