Wednesday, 15 April 2020

Program print following sequence

aaaaa
bbbbb
AAAAA
BBBBBB


public class ATS
public static void main(String[]args) 
int a = 97; 
for (int i = 1; i <= 4; i++) 
for (int j = 1; j <= 5; j++) 
System.out.print((char)a + " ");             
}             
a++; 
if (i == 2)                 
a = 65; 
System.out.println();         
}     
}

No comments:

Post a Comment