1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mestny [16]
3 years ago
8

) Write the code to display the content below using user input. The program Name is Half_XmasTree. This program MUST use (ONLY)

for loops to display the output below from 10 to 1 therefore ...1st row prints 10 star 2nd row prints 9… 3rd print 8 stars and so forth... This program is controlled by the user to input the amount of row. A good test condition is the value of ten rows. The user will demand the size of the tree. Remember the purpose of print() and println()

Computers and Technology
1 answer:
harina [27]3 years ago
4 0

Answer:

Following are the program in java language that is mention below

Explanation:

import java.util.*;  // import package

public class Half_XmasTree // main class

{

public static void main(String args[])  // main method

{

int k,i1,j1; // variable declaration  

Scanner sc2=new Scanner(System.in);   // create the object of scanner

System.out.println("Enter the Number of rows : ");

k=sc2.nextInt(); // Read input by user

for(i1=0;i1<k;i1++)  //iterating the loop

{

for(j1=0;j1<i1;j1++)  // iterating the loop

System.out.print(" ");

for(int r=k-i1;r>0;r--)  //iterating loop

System.out.print("*");  // print *

System.out.println();

}

}

}

Output:

Following are the attachment of output

Following are the description of program

  • Declared a variable k,i1,j1 as integer type .
  • Create a instance of scanner class "sc2" for taking the input of the rows.
  • Read the input of row in the variable "K" by using nextInt() method .
  • We used three for loop for implement this program .
  • In the last loop we print the * by using system.println() method.

You might be interested in
1. Realizați o schemă logică pentru un algoritm care sa calculeze suma primelor
DIA [1.3K]

Explanation:

The clear rendering reads;

"1. Make a logic diagram for an algorithm to calculate the sum of premiums 100 natural numbers.

2. Make a logic diagram that displays a maximum of 2 natural numbers.

3. Make a logic diagram that displays the square of a natural number".

4 0
3 years ago
As a result of the Internet, people today
Nimfa-mama [501]

Answer:

hi there, the answer is

a. use more mobile devices

hope this helps :)

have a good day!

Explanation:

i just took the quiz rnnn

3 0
3 years ago
Read 2 more answers
Technician A says that in any circuit, electrical current takes the path of least resistance. Technician B says that while this
Galina-37 [17]
A. Both technicians hope this helps
3 0
4 years ago
Read 2 more answers
John is a doctor who is scheduled to perform surgery on a patient. The hospital offers the ability to create a 3-D model of the
Vsevolod [243]

Answer:

The hospital uses rendering software.

Explanation:

8 0
3 years ago
What does decimal 88 equal in binary. Explain and show your work for full marks.
lara31 [8.8K]

Answer:

01011000

Explanation:

Binary 01011000

Decimal 88

Hexadecimal 58

Bits 8

Equation 64 + 16 + 8

8 0
3 years ago
Read 2 more answers
Other questions:
  • A(n) ______ disk is a storage device that contains one or more inflexible, circular platters that use magnetic particles to stor
    11·1 answer
  • Friedman (1999) argues that "we are wrong to base health promotion in all societies on a Western framework for human development
    11·1 answer
  • Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binar
    11·1 answer
  • Read this excerpt from The Outsiders. Or I could have gotten one of the gang to come along, one of the four boys Darry and Soda
    10·2 answers
  • Arrange these steps of creating a presentation in the correct order.
    15·2 answers
  • What is a database in access
    7·1 answer
  • Which topology requires a multipoint connection?
    6·1 answer
  • In implementing Secunity Lfe Cycle:_______
    8·1 answer
  • Answer first get branlest
    10·2 answers
  • There is a group of 10 people who are ordering pizza. If each person gets 2 slices and each pizza has 5 slices, how many pizzas
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!