Compiling ForForTest.java......
------Output------
*
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
[Finished in 1.3s]
class ForForTest{
public static void main (String[] args){
for(int x=0;x<5;x++){
for(int y=x;y<5;y++){
System.out.print("\t");
}
// if(x==0){
// System.out.print("*");
// }
// else
System.out.print("*");
for(int y=0;y<x;y++){
System.out.print("\t\t");
}
if(x==0){
System.out.println();
}
else
System.out.println("*");
}
for(int x=0;x<=5;x++){
for(int y=0;y<x;y++){
System.out.print("\t");
}
if(x!=5)
System.out.print("*");
for(int y=x;y<5;y++){
System.out.print("\t\t");
}
// if(x==0){
// System.out.println("*");
// }
// else
System.out.println("*");
}
}
} |
|