Write a program in Java to display the following pattern:
bo
tt
le
s
Java
Java Nested for Loops
6 Likes
Answer
publicclassKboatPattern{publicstaticvoidmain(String args[]){String str ="bottles";for(int i =0; i < str.length(); i++){System.out.print(str.charAt(i));if( i %2!=0)System.out.println();}}}