help me please numbers pattern

input
5

output
12345
23451
34512
45123
51234

closed account (48T7M4Gy)
42
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <string>

int main()
{
    for (int j = 0; j < 5; j ++)
    {
        for ( int i = j; i < j + 5; i++ )
           std::cout << 1 + (i + 5) % 5;
        
        std::cout << std::endl;
    }
}
Last edited on
Topic archived. No new replies allowed.