+ 7
java program to print inverted triangle
java
3 ответов
+ 8
public class print pattern
{
public static void main(string args[])
{
int space = 0;
for(int i=5;i>=1;1--)
{
for(int j=1;j<=space;j++)
System.out.print("");
for(int j=1;j<=i;j++)
System.out.print("*");
System.out.println();
space++;
}
}
}
+ 5
public class InvertedTriangle{ public static void main(String args[]) { for (int i= 5; i >= 1; i--) { for (int j = 0; j < 5 - i; j++){ System.out.print(' '); } for (int j = (2 - i); j < (2 - i) + (2 * i - 1); j++){ System.out.print('*'); } System.out.print('\n'); } } }
0
public class Pattern
{
public static void main(String args[])
{
for(int i=0;i<5;i++)
{
for(int j=0;j<i;j++)
System.out.print(" ");
for(int j=0;j<(2*5-1)-(2*i);j++)
System.out.print("*");
System.out.println();
}
}
}