Example: A B C D E F G H I J
Answer :
public class TriangleAlphabet {
public static void main(String[] args)
{
char c=65;
int rowNum=4;
for(int i=1;i<=rowNum;i++)
{
for(int j=0;j<(i);j++)
{
System.out.print(c+" ");
c++;
}
System.out.println();
}
No comments:
Post a Comment