upper left as well as upper right triangle

Amir_Tb

New Member
input:abci want to insert blank spaces as shown in required output\[code\]required output: abcabcab--bca----cBut mine comes asabcabcabbcac public static void triangle(String s){ int length = s.length(); for(int i=0;i<2*length;i++){ System.out.println(); for(int j=0;j<length-i;j++){ System.out.print(" "+s.charAt(j)); } for(int k=i;k<length;k++){ System.out.print(" "+s.charAt(k)); } } }\[/code\]any help will be helpful to meany alternate solution/help will also be appreciated
 
Back
Top