Print Right Angle Triagle in Java
Below prints right angle triangle.
public class PrintRightAngleTriangle {
public static void main(String[] args) {
for(int i=0; i<=10 ; i++){
for(int j=0;j<=i;j++){
System.out.print("* ");
}
System.out.println();
}
}
}
Output:
--------
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * * * * *
* * * * * * * * * * *
public class PrintRightAngleTriangle {
public static void main(String[] args) {
for(int i=0; i<=10 ; i++){
for(int j=0;j<=i;j++){
System.out.print("* ");
}
System.out.println();
}
}
}
Output:
--------
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * * * * *
* * * * * * * * * * *
Comments
Post a Comment