java - please Correct For Loop Design -
class aaaaa { public static void main(string[] args) { (int = 0; <= 10; i++) { (int k = 10; k < i; k++) { system.out.print(" "); } (int j = 100; j >=10; j=j-10) { system.out.print(j); } system.out.println(""); } } }
i want output:
100 90 80 70 50 40 30 20 10 ----------------- 90 90 70 60 50 40 30 20 10 ----------------- 80 70 60 50 40 30 20 10 ----------------- 70 60 50 40 30 20 10 ----------------- 60 50 40 30 20 10 ----------------- 50 40 30 20 10 ----------------- 40 30 20 10 ----------------- 30 20 10 ----------------- 20 10 ----------------- 10 -----------------
but it's like:
100908070605040302010 ----------------- 100908070605040302010 ----------------- 100908070605040302010 ----------------- 100908070605040302010 ----------------- 100908070605040302010 ----------------- 100908070605040302010 ----------------- 100908070605040302010 ----------------- 100908070605040302010 ----------------- 100908070605040302010 ----------------- 100908070605040302010 ----------------- 100908070605040302010 -----------------
look @ example code. want do.
public static void main(string[] args) { for(int = 0; < 10; i++) { for(int j = 10 - i; j > 0; j = j--) { system.out.print(j * 10); system.out.print(" "); } system.out.println(); system.out.println("-----------------"); } }
Comments
Post a Comment