Responsive image
Responsive image

Write a program to display the given numeric patterns.

 

1
12
123
1234
12345

CLS
FOR J=1 TO 5
       FOR K=1 TO J
              PRINT K;
       NEXT K
       PRINT
NEXT J
END

PROCESS TABLE (EXECUTION TABLE)

Outer loop (J=1 TO 5)

Inner loop (K=1 TO J)

PRINT K;

1

1 TO 1

1

2

1 TO 2

12

3

1 TO 3

123

4

1 TO 4

1234

5

1 TO 5

12345

 

5
45
345
2345
12345

CLS
FOR J=5 TO 1 STEP-1
       FOR K=J TO 5
              PRINT K;
       NEXT K
       PRINT
NEXT J
END

PROCESS TABLE (EXECUTION TABLE)

Outer loop (J=5 TO 1 STEP-1)

Inner loop (K=J TO 5)

PRINT K;

5

5 TO 5

5

4

4 TO 5

45

3

3 TO 5

345

2

2 TO 5

2345

1

1 TO 5

12345

 

5
54
543
5432
54321

CLS
FOR J=5 TO 1 STEP-1
       FOR K=5 TO J STEP-1
              PRINT K;
       NEXT K
       PRINT
NEXT J
END

PROCESS TABLE (EXECUTION TABLE)

Outer loop (J=5 TO 1 STEP-1)

Inner loop (K=5 TO J STEP-1)

PRINT K;

5

5 TO 5

5

4

5 TO 4

54

3

5 TO 3

543

2

5 TO 2

5432

1

5 TO 1

54321

 

9
79
579
3579
13579

CLS
FOR J=9 TO 1 STEP-2
       FOR K=J TO 9 STEP 2
              PRINT K;
       NEXT K
       PRINT
NEXT J
END

PROCESS TABLE (EXECUTION TABLE)

Outer loop (J=9 TO 1 STEP-2)

Inner loop (K=J TO 9 STEP 2)

PRINT K;

9

9 TO 9

9

7

7 TO 9

79

5

5 TO 9

579

3

3 TO 9

3579

1

1 TO 9

13579

 

12345
2345
345
45
5

CLS
FOR J=1 TO 5
       FOR K=J TO 5
              PRINT K;
       NEXT K
       PRINT
NEXT J
END

PROCESS TABLE (EXECUTION TABLE)

Outer loop (J=1 TO 5)

Inner loop (K=J TO 5)

PRINT K;

1

1 TO 5

12345

2

2 TO 5

2345

3

3 TO 5

345

4

2 TO 5

45

5

1 TO 5

5

 

 

1
22
333
4444
55555

CLS
FOR J=1 TO 5
       FOR K=1 TO J
              PRINT J;
       NEXT K
       PRINT
NEXT J
END

PROCESS TABLE (EXECUTION TABLE)

Outer loop (J=1 TO 5)

Inner loop (K=1 TO J)

PRINT J;

1

1 TO 1

1

2

1 TO 2

22

3

1 TO 3

333

4

1 TO 4

4444

5

1 TO 5

55555

 

5
44
333
2222
11111

CLS
FOR J=5 TO 1 STEP-1
       FOR K=J TO 5
              PRINT J;
       NEXT K
       PRINT
NEXT J
END

PROCESS TABLE (EXECUTION TABLE)

Outer loop (J=5 TO 1 STEP-1)

Inner loop (K=J TO 5)

PRINT J;

5

5 TO 5

5

4

4 TO 5

44

3

3 TO 5

333

2

2 TO 5

2222

1

1 TO 5

11111

 

55555
4444
333
22
1
CLS
FOR J=5 TO 1 STEP-1
       FOR K=1 TO J
              PRINT J;
       NEXT K
       PRINT
NEXT J
END

PROCESS TABLE (EXECUTION TABLE)

Outer loop (J=5 TO 1 STEP-1)

Inner loop (K=1 TO J)

PRINT J;

5

1 TO 5

55555

4

1 TO 4

4444

3

1 TO 3

333

2

1 TO 2

22

1

1 TO 1

1

 

 

11111
2222
333
44
5

CLS
FOR J=1 TO 5
       FOR K=J TO 5
              PRINT J;
       NEXT K
       PRINT
NEXT J
END

PROCESS TABLE (EXECUTION TABLE)

Outer loop (J=1 TO 5)

Inner loop (K=J TO 5)

PRINT J;

1

1 TO 5

11111

2

2 TO 5

2222

3

3 TO 5

3333

4

2 TO 5

44

5

1 TO 5

5



Post Your Comment Here