Computer Science, asked by kamalpoudel704, 2 months ago

Develope PROGRAM OF 12345 2345 345 45 5

Answers

Answered by gargritvik2018
0

Answer:

This program has been written in Java language.

public class Answer

{

   public static void main (String []args)

   {

       //1st method

       System.out.println();

       int i,j;

       for(i=1;i<=5;i++)

       {

           for(j=i;j<=5;j++)

               System.out.print(j + " ");

           System.out.println();

       }

       

       //2nd method

       System.out.println();

       int m,n,k;

       for(m=1;m<=5;m++)

       {

           for(n=1;n<=m;n++)

               System.out.print("  ");

           for(k=m;k<=5;k++)

               System.out.print(k + " ");

           System.out.println();

       }

   }

}

Attachments:
Similar questions