iNTRODUCTION TO JAVA PROGRAMING
Write a program that prints a triangle using star (*)
maximum star (10)
Ans :
Code:
public class Main
{
public static void main(String[] args) {
int rows = 10;
for (int i= rows-1; i>=0 ; i--)
{
for (int j=0; j<=i; j++)
{
System.out.print("*");
}
System.out.println();
}
}
}
Output:
Get Answers For Free
Most questions answered within 1 hours.