Anonymous

I Need A Java Code That Will Output A Number 1-20 And Will Shape A Triangle?

1

1 Answers

Alongbar Daimary Profile
//Program  Style 1  class Triangle{ public static void main(String[]ar){ int Limit=20; int Prn=1; for(int I=1;I<=Limit;I++){ for(int j=1;j<=I;j++){ if (Prn==Limit) return; System.out.print("t" + Prn); Prn++; } System.out.print("n"); } } }  //Program Style 2  class Triangle{ public static void main(String[]ar){ int Limit=10; for(int I=1;I<=Limit;I++){ for(int j=1;j<=I;j++){ System.out.print("t" + I); } System.out.print("n"); } } }

Answer Question

Anonymous