Monday, 24 January 2022

A) Write a java program to display following pattern:

Slip 5 Q 1

Save code as         "pattern.java"


        5

        4 5

        3 4 5

        2 3 4 5 

        1 2 3 4 5 

public class pattern {
    public static void main(String[] args) {
        int n=5;
        for (int i=n;i>0;i--){
            for (int j=i;j<=n;j++){
                System.out.print(j+" ");
            }
            System.out.println();
        }
    }
}


OUTPUT :



No comments:

Post a Comment

Write a Java program to display given extension files from a specific directory on server machine.

 DOWNLOAD     SLIP14Q2 /** * STEPS TO RUN CODE * Step 01 compile the code * Step 02 run the code * Step 03 give a file directory locatio...