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
Nadusha1986 [10]
3 years ago
7

Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each number by a space.

Computers and Technology
1 answer:
Ksenya-84 [330]3 years ago
3 0

Answer:

   while(userNum>=1){

       System.out.print(userNum/2+" ");

       userNum--;

        }

Explanation:

This is implemented in Java programming language. Below is a complete code which prompts a user for the number, receives and stores this number in the variable userNum.

<em>import java.util.Scanner;</em>

<em>public class TestClock {</em>

<em>    public static void main(String[] args) {</em>

<em>    Scanner in = new Scanner (System.in);</em>

<em>        System.out.println("Enter the number");</em>

<em>    int userNum = in.nextInt();</em>

<em>    while(userNum>=1){</em>

<em>        System.out.print(userNum/2+" ");</em>

<em>        userNum--;</em>

<em>         }</em>

<em>    }</em>

<em>}</em>

The condition for the while statement is userNum>=1 and after each iteration we subtract 1 from the value of   userNum until reaching 1 (Hence userNum>=1)

You might be interested in
What does a network backbone do? allows data to be delivered more quickly and efficiently makes data transfer from the cloud mor
Musya8 [376]

Answer:

A network backbone connects multiple networks together, allowing them to communicate with each other.

5 0
3 years ago
Read 2 more answers
why might a portrait be both a portrait of the subject and the photographer? how is a photographer present in a portrait?
Nataliya [291]
Because of the reflection on the window or mirror.
5 0
3 years ago
Read 2 more answers
You create a database that stores data in tables that consist of rows and columns. each row has a primary key, and each column h
jeyben [28]
The answer is a relational database.

A data model in database management system consists of rules that define how the DB organizes data. Today, a relational database is widely used. It is a collection of data items organized as a set of formally described tables from which data can be accessed in many different ways.



3 0
3 years ago
Read 2 more answers
Kiara is using her software's graphic formats to create a line graph. As she
Ad libitum [116K]

Correct the data she entered , and the software will adjust the graph -apex

5 0
3 years ago
Read 2 more answers
What is wrong with the formula below? SUM(A1:A5)/SUM(B1:B5)
Triss [41]
I think the answer would be C
5 0
3 years ago
Read 2 more answers
Other questions:
  • Choose the correct sequence for classifier building from the following.
    7·1 answer
  • Which of the following is a popular open source intrusion detection system that runs on SmoothWall?? Synchronous Dynamic Random
    6·1 answer
  • assume an int array, candy, stores the number of candy bars sold by a group of children wherecandy[j] is the number of candy bar
    7·2 answers
  • Which words in the sentence make up the adjective phrase? Which word does the adjective phrase modify? The farmer delivers five
    15·1 answer
  • Which hardware device connects your network to the internet? select one:
    15·1 answer
  • I neeeeeeeeeeeddddddddddddd help plz ppl
    10·2 answers
  • You want to copy data from one cell or range to an adjacent cell or range in your spreadsheet, without using a shortcut key. Whi
    10·1 answer
  • Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    6·1 answer
  • When a user problem cannot be solved by the help desk at the first level of resolution, the problem is ___________ to the second
    7·1 answer
  • What is the function of a primary key in a table? to uniquely identify each record in the table to uniquely identify foreign key
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!