+ 3
This programm not giving output in triangle manner?
public class AngledTriangle { public static void main(String[] args) { int height = 8; for(int i = 1; i <= height; i++) { for (int j = 1; j <= i; j++) { System.out.println("*"); } System.out.println(); } } }
8 Answers
+ 3
Take a look at this :
https://code.sololearn.com/cNcyHJ1fc3Oa/?ref=app
+ 2
What is your aim with the program?
It gives the following error message:
..\Playground\:1: error: class, interface, or enum expected
+ 2
Sorry Lennie.....it's working properly on my screen. just not showing triangle .
+ 2
public class AngledTriangle {
public static void main(String[] args) {
int height = 8;
System.out.println ("*");
for(int i = 1; i < height; i++) {
System.out.print ("*");
for(int j = 1; j <= i; j++) {
System.out.print(" ");
}
System.out.println("*");
}
for (int j = 1; j <= height; j++) {
System.out.print(" *");
}
}
}
//here sololearn help me//
+ 2
just use âprintâ instead âprintlnâ in your first print statement
+ 1
Thank You Zhenis Otarbay
+ 1
That's great Aparesh Bhunia