ICSE Class 10 Computer Applications
Question 9 of 22
Nested for loops — Question 9
Back to all questions 9
Question Question 2(viii)
Write a program in Java to display the following patterns.
I
I C
I C S
I C S E
public class KboatPattern
{
public static void main(String args[]) {
String str = "ICSE";
int len = str.length();
for(int i = 0; i < len; i++) {
for(int j = 0; j <= i; j++) {
System.out.print(str.charAt(j) + " ");
}
System.out.println();
}
}
}Output
