Exercises 5- Patterns

Please learn Nested Loop concepts before start solving this problems.


N = 5

*    *    *    *    *
*    *    *    *    *
*    *    *    *    *
*    *    *    *    *
*    *    *    *    *

N = 3

3    3    3
3    3    3
3    3    3

N = 5

1    1    1    1    1
2    2    2    2    2
3    3    3    3    3
4    4    4    4    4
5    5    5    5    5

N = 5


N = 5


N = 5


N = 5


N = 5


N = 5


N = 4

Challenge: try to achieve the pattern exactly with spacings.


N = 5


N = 5, Assume N will be always odd number and N > 3


N = 5


N = 5


N = 5


Last updated