C++ Multiplication table Vertically from 1 to n

Write a program in C++ to display the multiplication table vertically from 1 to n.

Flowchart of Multiplication table in C++

Flowchart of Multiplication table Program using do while loop C++

C++ Source Code of Program of Multiplication table Vertically from 1 to n

Output

C++ Source Code of Program of Multiplication table Vertically from 1 to n

 

Exercise

Find the possible mistakes in the following Shamil’s Flow Table of the program of  Multiplication Table vertically from 1 to 2.

Loop

a=1,  b=2

Condition What line will execute Actual work to do
j=1<=10

 

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 17 j=1

i*j=1,  j++,  j=2

j=2<=10

 

True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17

1*2=2

j++, j=3

j=3<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,17

1*3=3

j++, j=4

j=4<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17

1*4=4

j++, j=5

j=5<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16, 17

1*5=5

j++, j=6

j=6<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16, 17

1*6=6

j++, j=7

j=7<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16, 17

1*7=7

j++, j=8

j=8<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16, 17

1*8=8

j++, j=9

j=9<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16, 17

1*9=9

j++, j=10

j=10<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16, 17

1*10=10

j++, j=11

j=11<=10 False 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19, 20

i++,  i=2
 

i<=b, b=2

1<=2

 

True

 

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16

 

j=1

i*j=2*1=2

j++,  j=2

j<=10

j=2<=10

True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

j=1

i*j=2*2=4

j++,  j=3

j=3<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

,17,12,13,14,15,16

j=1

i*j=2*3=6

j++,  j=4

j=4<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

,17,12,13,14,15,16,17,12,13,14,15,16

j=1

i*j=2*4=8

j++,  j=5

j=5<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

,17,12,13,14,15,16,17,12,13,14,15,16, 17,12,13,14,15,16

j=1

i*j=2*5=10

j++,  j=6

j=6<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

,17,12,13,14,15,16,17,12,13,14,15,16, 17,12,13,14,15,16, 17,12,13,14,15,16

j=1

i*j=2*6=12

j++,  j=7

j=7<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

,17,12,13,14,15,16,17,12,13,14,15,16, 17,12,13,14,15,16, 17,12,13,14,15,16

, 17,12,13,14,15,16

j=1

i*j=2*7=14

j++,  j=8

j=8<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

,17,12,13,14,15,16,17,12,13,14,15,16, 17,12,13,14,15,16, 17,12,13,14,15,16

, 17,12,13,14,15,16, 17,12,13,14,15,16

j=1

i*j=2*8=16

j++,  j=9

j=9<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

,17,12,13,14,15,16,17,12,13,14,15,16, 17,12,13,14,15,16, 17,12,13,14,15,16

, 17,12,13,14,15,16, 17,12,13,14,15,16

, 17,12,13,14,15,16

j=1

i*j=2*9=18

j++,  j=10

j=10<=10 True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

,17,12,13,14,15,16,17,12,13,14,15,16, 17,12,13,14,15,16, 17,12,13,14,15,16

, 17,12,13,14,15,16, 17,12,13,14,15,16

, 17,12,13,14,15,16

j=1

i*j=2*10=20

j++,  j=11

 

 

 

 

j=11<=10

 

 

 

 

 

 

 

False

 

 

 

 

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

,17,12,13,14,15,16,17,12,13,14,15,16, 17,12,13,14,15,16, 17,12,13,14,15,16

, 17,12,13,14,15,16, 17,12,13,14,15,16

, 17,12,13,14,15,16,17,

 

 

 

 

i++

i=3

i<=b

i=3<=2

 

 

False 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,

17,12,13,14,15,16,17, 12,13,14,15,16,

17, 12,13,14,15,16, 17, 12,13,14,15,16

, 17, 12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,12,13,14,15,16

,17,12,13,14,15,16,17,18,19,20,9, ,10,11,12,13,14,15,16,17,12,13,14,15,16,

,17,12,13,14,15,16,17,12,13,14,15,16, 17,12,13,14,15,16, 17,12,13,14,15,16

, 17,12,13,14,15,16, 17,12,13,14,15,16

, 17,12,13,14,15,16,17,18,19,20,21

End

Flowchart of Multiplication table Vertically from 1 to n using for loop

Multiplication table Vertically from 1 to n using for loop in C++

C++ Source Code of Program of Multiplication table Vertically from 1 to n using for loop

Lets us see the Program of Multiplication table showing Vertically from 1 to n by using for loop.

Output

C++ Program of Multiplication table Vertically from 1 to n using for loop

 

Declarations Flow table (DFT) of Multiplication table Vertically from 1 to n

Let us see the DFT of the above program.

Variable Declaration

(Line Number)

Initialization

(Line Number)

Use

(Line Number)

I 5 9A,9C 9B,19,15
j 5 11A,11C, 11B,13,15,19
n 5 7 9B,13

Flowchart of first 10 natural numbers using while loop

Sum of the 1st ten natural numbers in C++ using while loop

Sum of the 1st ten natural numbers in C++ using while loop

Output

The first 10 natural number is :

1 2 3 4 5 6 7 8 9 10

The Sum is : 55

 

Add a Comment