public class Loops{ public void diag(int n) { int i; String s = ""; for(i=0;i<n;i++) { System.out.println("*"); s = s + " "; System.out.print(s); } } public void diagWord(String n) { int i; String s = ""; for(i=0;i<n.length;i++) { System.out.println(n.substring(i, i+1); s = s + " "; System.out.print(s); } } }