Home » Java program to print the following pattern on the console 8

Java program to print the following pattern on the console 8

by Online Tutorials Library

Java program to print the following pattern on the console

Java program to print the following pattern on the console

Algorithm:

  • STEP 1: START
  • STEP 2: SET coe=1, rows= 6.
  • STEP 3: SET i=0. REPEAT STEP 4 to STEP 11 UNTIL i
  • STEP 4: SET space = 1. REPEAT STEP 5 and STEP 6 UNTIL space<(rows ?i)
  • STEP 5: PRINT “”
  • STEP 6: ++space
  • STEP 7: SET j=0. REPEAT STEP 8 to STEP 9 UNTIL j<=i .
  • STEP 8: IF(j==0||i==0)
                    SET coe=1
                    ELSE
                    SET coe=coe*(i-j+1) /j
                    PRINT coe
  • STEP 9: SET j = j+1
  • STEP 10: PRINT new line.
  • STEP 11: SET i=i+1
  • STEP 12: END

Program:

Output:

Java program to print the following pattern on the console

Next TopicJava Programs

You may also like