/*
print numbers something like this
54321
5432
543
54
5
*/
package starslayout;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class starEleven
{
public static void main(String[] args) throws Exception
{
int n,j,i,k;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
Scanner sc=new Scanner(System.in);
System.out.println("Enter limit of the levels of star : ");
n=sc.nextInt();
for(i=1;i<=n;i++)
{
for(j=n;j>=i;j--)
System.out.print(j);
System.out.println();
}
}
}
Output
Enter limit of the levels of star :
5
54321
5432
543
54
5
print numbers something like this
54321
5432
543
54
5
*/
package starslayout;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class starEleven
{
public static void main(String[] args) throws Exception
{
int n,j,i,k;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
Scanner sc=new Scanner(System.in);
System.out.println("Enter limit of the levels of star : ");
n=sc.nextInt();
for(i=1;i<=n;i++)
{
for(j=n;j>=i;j--)
System.out.print(j);
System.out.println();
}
}
}
Output
Enter limit of the levels of star :
5
54321
5432
543
54
5
No comments:
Post a Comment