Character Pattern
- Get link
- X
- Other Apps
Sample Input 1:
5
Sample Output 1:
A
BC
CDE
DEFG
EFGHI
import java.util.Scanner;
public class CharacterPattern {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n= s.nextInt();
for(int i=1;i<=n;i++)
{
char c=(char)('A'+ i -1);
for(int j=1;j<=i;j++)
{
System.out.print(c);
c++;
}
System.out.println();
}
}
}
- Get link
- X
- Other Apps
Comments
Post a Comment