/*
ASCII values Capital letters starts from 65 to 90
Ex - A - 65
*/
package starslayout;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class starTwentyOne
{
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();
k=65+n;
for(i=65;i<=k;i++)
{
for(j=65;j<=i;j++)
System.out.print((char)j);
System.out.println();
}
}
}
Output
Enter limit of the levels of star :
6
A
AB
ABC
ABCD
ABCDE
ABCDEF
ABCDEFG
No comments:
Post a Comment