Computer Science, asked by abhisingh22, 11 months ago

(h) 5 4 3 21
5 4 3 2
543
54
5
write aprogram​

Answers

Answered by tuhinchandra2004
0

Answer:

54321

5432

543

54

5

Explanation:

public class pattern

{

public static void main(String args[])

{

int i, j;

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

{

for(j=5;j>=i;j--)

System.out.print(j) ;

System.out.println() ;

}

}

}

I have written this in java

HOPE it helps you

Answered by dreamrob
0

Pattern

5 4 3 2 1

5 4 3 2

5 4 3

5 4

5

Program in C++

#include<iostream>

using namespace std;

int main()

{

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

{

 for(int j=5;j>=i;j--)

 {

  cout<<j<<" ";

 }

 cout<<endl;

}

return 0;

}

Program in JAVA

import java.util.*;

class Pattern  

{    

public static void main(String args[])    

{        

Scanner Sc = new Scanner(System.in);

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

{

 for(int j=5;j>=i;j--)

 {

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

 }

 System.out.println();

}

}

}

Similar questions