Question

iNTRODUCTION TO JAVA PROGRAMING Write a program that prints a triangle using star (*) maximum star...

iNTRODUCTION TO JAVA PROGRAMING

Write a program that prints a triangle using star (*)

maximum star (10)

  • Program output
  • **********
  • *********
  • ********
  • *******
  • ******
  • *****
  • ****
  • ***
  • **
  • *

Homework Answers

Answer #1

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:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program in JAVA that prints the bounds ( maximum and minimum values) for all...
Write a program in JAVA that prints the bounds ( maximum and minimum values) for all integer data types in Java.
JAVA CODE Write a program which has a 3D array and prints the integers from the...
JAVA CODE Write a program which has a 3D array and prints the integers from the array. Then then convert the output into a file using filewriter
Using for loops: - write a Java program that adds numbers between 1 to 100 and...
Using for loops: - write a Java program that adds numbers between 1 to 100 and prints the result. - write a Java program that adds odd numbers between 1 to 100 and prints the result - write a Java program that averages even numbers between 5 to 30 and prints the result
In MIPS/MARS 1)Write a program that prints your name in a Triangle.
In MIPS/MARS 1)Write a program that prints your name in a Triangle.
Write a Java program that calculates and prints the monthly pay for an employee. The net...
Write a Java program that calculates and prints the monthly pay for an employee. The net pay is calculated after taking the following deductions: Withholding Tax 10% SSS Contribution 2.50% Medicare 1.30% PensionPlan PHP 200.00
Write code in JAVA Write a program that will output a right triangle based on user...
Write code in JAVA Write a program that will output a right triangle based on user specified input height (int) and specified input symbol (char).The first line will have one user-specified character, such as % or *. Each subsequent line will have one additional user-specified character until the number in the triangle's base reaches specified input height. Output a space after each user-specified character, including after the line's last user-specified character. Hint: Use a nested for loop. Ex:If the input...
Using Java code and ARRAYS, please write a program that takes in the names of four...
Using Java code and ARRAYS, please write a program that takes in the names of four individuals and prints out all the names. The number of names (4) is predetermined.
In Java. Write a program that reads-in a times table-number. The program, using this table-number will...
In Java. Write a program that reads-in a times table-number. The program, using this table-number will produce the following report (as shown). The first item in the report is a number with starting value 1. Second column is the word “ X ” (representing the times symbol). Third column is the table-number (itself). Following is an equal sign “ = “ (representing a result). Last column is the result of the operation for that line or row which is the...
Write a program that asks the user to enter an odd number and prints out a...
Write a program that asks the user to enter an odd number and prints out a triangle pattern. For example, if the user enters 5, the output is note: There is one space between the numbers in each line 1 3 5 1 3 1 If the user enters 9 the output is: 1 3 5 7 9 1 3 5 7 1 3 5 1 3 1 program language: C++
Problem Statement: Write a Java program “HW6_lastname.java” that prints a program title and a menu with...
Problem Statement: Write a Java program “HW6_lastname.java” that prints a program title and a menu with four items. The user should then be prompted to make a selection from the menu and based on their selection the program will perform the selected procedure. The title and menu should be as the following: Student name: <your name should be printed> CIS 232 Introduction to Programming Programming Project 6 Due Date: October 23, 2020 Instructor: Dr. Lomako ******************************** 1.     Compute Angles                               *...