0
Pattern
I was stuck with a pattern. Can some one help me. Note that input represents the number of rows. input:- 5 output:- 15 14 10 13 09 06 12 08 05 03 11 07 04 02 01 input:- 7 output:- 28 27 21 26 20 15 25 19 14 10 24 18 13 09 06 23 17 12 08 05 03 22 16 11 07 04 02 01
2 Answers
+ 1
You can either derive a formula for the number in the i-th row and j-th column. Or, you can use a print buffer (2-dim array) and first write to memory, and then print the memory representation of your pattern.