vendredi 4 mars 2016

take input from user and print a squre matrix of a specific kind [on hold]

I am trying to code in c++ I need to enter the an integer and according to that integer value print a pattern in matrix form for example:

if n=3 then print
1 2 3
7 8 9
4 5 6
if n = 4 then
1  2  3  4
9 10 11 12
13 14 15 16
 5  6  7  8
if n = 5 then print
1  2  3  4  5
11 12 13 14 15
21 22 23 24 25
16 17 18 19 20 
 6  7  8  9 10

please be as elaborate as you can be thank you

Aucun commentaire:

Enregistrer un commentaire