KnowledgeBoat Logo

Java Pattern Programs

  • Java String Handling

    Write a program to generate a triangle or an inverted triangle based upon User’s choice.

    Example 1:
    Input: Type 1 for a triangle and
    Type 2 for an inverted triangle
    Enter your choice 1
    Enter a word : BLUEJ
    Sample Output:
    B
    L L
    U U U
    E E E E
    J J J J J

    Example 2:
    Input: Type 1 for a triangle and
    Type 2 for an inverted triangle
    Enter your choice 2
    Enter a word : BLUEJ
    Sample Output:
    B L U E J
    B L U E
    B L U
    B L
    B

    View Answer

    12 Likes


  • Java Nested for Loops

    Write a program in Java to display the following pattern:

    11
    12 22
    13 23 33
    14 24 34 44
    15 25 35 45 55


  • Java Nested for Loops

    Write a program in Java to display the following pattern:

    1   
    3  5   
    5  7  9   
    7  9  11  13   
    9  11 13  15  17
    

    View Answer

    12 Likes


  • Java Nested for Loops

    Write a program in Java to display the following pattern:

    11 13 15 
    17 19 
    21
    


  • Java Nested for Loops

    Write a program in Java to display the following pattern:

    3
    5 6
    8 9 10
    12 13 14 15


  • Java Nested for Loops

    Write a program in Java to display the following pattern:

    1 2 3 4 5
    2 2 3 4 5
    3 2 3 4 5
    4 2 3 4 5
    5 2 3 4 5


  • Java Nested for Loops

    Write a program in Java to display the following pattern:

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

    View Answer

    11 Likes


  • Java Nested for Loops

    Write a program in Java to display the following pattern:

    123454321
    1234321
    12321
    121
    1


  • Java Nested for Loops

    Write a program in Java to display the following pattern:

    5
    454
    34543
    2345432
    123454321


  • Java Nested for Loops

    Write a program in Java to display the following pattern:

    225 196 169 144 121
    100 81  64  49
    36  25  16
    9   4
    1
    


Showing 61 - 70 of 87 Questions