Computer Science, asked by Sayani07, 10 months ago

Write a program in java to print
10
20 30
40 50 60
70 80 90 100​

Answers

Answered by sushantn10
0

Answer:

Write a program to print the following pattern.

1

2 4

3 6 9

4 8 12 16

5 10 15 20 25

6 12 18 24 30 36

7 14 21 28 35 42 49

8 16 24 32 40 48 56 64

9 18 27 36 45 54 63 72 81

10 20 30 40 50 60 70 80 90 100

Algorithm

STEP 1: START

STEP 2: SET lines =10

STEP 3: SET i=1

STEP 4: REPEAT STEP 5 to 9 UNTIL i is less than or equals to lines

STEP 5: SET j=1

STEP 6: REPEAT STEP 7 UNTIL j is less than or equals to i

STEP 7: PRINT i*j and SET j = j + 1

STEP 8: PRINT new line

STEP 9: SET i = i + 1

STEP 10: EXIT

Solution:

C Program:

#include <stdio.h>

int main()

{

int lines=10;

int i=1;

int j;

for(i=1;i<=lines;i++){// this loop is used to print lines

for(j=1;j<=i;j++){// this lop is used to print the table of the i

printf("%d ",i*j);

}

printf("\n");

}

return 0;

}

Output:

1

2 4

3 6 9

4 8 12 16

5 10 15 20 25

6 12 18 24 30 36

7 14 21 28 35 42 49

8 16 24 32 40 48 56 64

9 18 27 36 45 54 63 72 81

10 20 30 40 50 60 70 80 90 100

Similar questions