# Program in C++ to make such a pattern like a pyramid with a number that will repeat the number in the same row.

Write a program in C++ to make such a pattern like a pyramid with a number that will repeat the number in the same row.

Output

## Excercise

Find the possible mistakes in the following Shamil’s Flow Table of the Program to make such a pattern like a pyramid with a number that will repeat the number in the same row.

 What statement will be executed? Loop(r)=1, Loop(sp)=1 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 output? – Loop(r)=1, Loop(sp)=2 1,2,3,4,5,6,7,8,9,10,11,12,13,14 ,15,16,17,18, 13,14,15,16,17,18   output? — Loop(r)=1, Loop(sp)=3 1,2,3,4,5,6,7,8,9,10,11,12,13,14 ,15,16,17,18,13,14,15,16,17,18, 13,14,15,16,17,18 output? — Loop(r)=1, Loop(sp)=4, Loop(disp)=1 1,2,3,4,5,6,7,8,9,10,11,12,13,14 ,15,16,17,18, 13,14,15,16,17,18, 13,14,15,16,17,18 19,20,21,22,23,24,25,26 output? —1 Loop(r)=1, Loop(sp)=4, Loop(disp)=2 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18,)^3,19,20,21,22,23,24,25,26,27,28,29,30 output? Move to Next line Loop(r)=2, Loop(sp)=1 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18)^3,19,20,21,22,23,24,25,26,27,28,29,30,10,11,12,13,14,15,16,17,18 output? – Loop(r)=2, Loop(sp)=2, 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18)^3,19,20,21,22,23,24,25,26,27,28,29,30,10,11,12,13,14,15,16,17,18,10,11,12,13,14,15,16,17,18 output? — Loop(r)=2, Loop(sp)=3, Loop(disp)=1 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18)^3,19,20,21,22,23,24,25, 26,27,28,29,30,(10,11,12,13,14,15,16,17,18)^2,19,20,21,22,23,24,25,26 output? –2 Loop(r)=2, Loop(sp)=3, Loop(disp)=2 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18)^3,19,20,21,22,23,24,25,26,27,28,29,30,(10,11,12,13,14,15,16,17,18)^2,19,20,21,22 ,23,24,25,26,21,22,23,24,25,26 output? –2-2 Loop(r)=2, Loop(sp)=3, Loop(disp)=3 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18)^3,19,20,21,22,23,24,25,26,27,28,29,30,(10,11,12,13,14,15,16,17,18)^2,19,20,(21,22,23,24,25,26)^2,27,28,29, output? Move to Next line Loop(r)=3, Loop(sp)=1 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18)^3,19,20,21,22,23,24,25,26,27,28,29,30,(10,11,12,13,14,15,16,17,18)^2,19,20,(21,22,23,24,25,26)^2,27,28,29,30,10,11,12,13,14,15,16,17,18 output? – Loop(r)=3, Loop(sp)=2, Loop(disp)=1 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18)^3,19,20,21,22,23,24,25,26,27,28,29,30(10,11,12,13,14,15,16,17,18)^2,19,20,(21,22,23,24,25,26)^2,27,28,29,30,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26 output? -3 Loop(r)=3, Loop(sp)=2, Loop(disp)=2 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18)^3,19,20,21,22,23,24,25,26,27,28,29,30(10,11,12,13,14,15,16,17,18)^2,19,20,(21,22,23,24,25,26)^2,27,28,29,30,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,21,22,23,24,25,26 output? -3-3 Loop(r)=3, Loop(sp)=2, Loop(disp)=3 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18)^3,19,20,21,22,23,24,25,26,27,28,29,30,(10,11,12,13,14,15,16,17,18)^2,19,20,(21,22,23,24,25,26)^2,27,28,29,30,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,21,22,23,24,25,26,21,22,23,24,25,26 output? -3-3-3 Loop(r)=3, Loop(sp)=2, Loop(disp)=4 1,2,3,4,5,6,7,8,9,10,11,12,(13,14,15,16,17,18)^3,19,20,21,22,23,24,25,26,27,28,29,30.(10,11,12,13,14,15,16,17,18)^2,19,20,(21,22,23,24,25,26)^2,27,28,29,30,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,21,22,23,24,25,26,21,22,23,24,25,26,27,28,29,30,31
Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,