Write a program to display the following output.
ENTER THE LIMIT:-
6
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
import java.util.Scanner; public class GenerateNumber1 { public static void main(String[] args) { int i,j; System.out.println( "ENTER THE LIMIT:-"); Scanner sc=new Scanner(System.in); int n=sc.nextInt(); for(i=1;i0;j--) { System.out.print(j+" "); } System.out.println(); } } } OUTPUT: ENTER THE LIMIT:- 6 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1
No comments:
Post a Comment