+ 7

java program to print inverted triangle

java

13th Jun 2018, 5:54 PM
narender
narender - avatar
3 Respostas
+ 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++; } } }
13th Jun 2018, 7:39 PM
Shubham goyal
Shubham goyal - avatar
+ 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'); } } }
13th Jun 2018, 6:22 PM
Tejas Gupta
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(); } } }
14th Jun 2018, 11:18 AM
Akshay Karande