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
A programming and software development professional would most likely help with
DiKsa [7]
A programming and software development professional would most likely help with
Testing a software program.
3 0
3 years ago
Which member of the Jackson family was the spokesperson for the Psychic Friends Network.​
Jlenok [28]

Answer:

La Toya Jackson

Explanation:

8 0
3 years ago
1<br> Q9. Which tool is used to cancel the<br> action of undo tool ? *
Stels [109]

Answer:

hold down CTRL + Z and it will reverse to the last action

6 0
3 years ago
Important of microcomputer in some point​
Sedbober [7]

Answer:

A microcomputer uses memory to store the programs that control its operation, to store data waiting for processing, and to store the results of operations performed by the CPU. Primary memory, or storage, is electronic memory that is directly addressable by the CPU.

Explanation:

brainliest plzzzzzzz

8 0
3 years ago
Read 2 more answers
name instances in the past where social media has kept you informed about the latest news around the country​
Luba_88 [7]
BLM movement and protests,
The election, school shootings, and the pandemic
3 0
3 years ago
Read 2 more answers
Other questions:
  • QUESTION : John travels a lot and he needs to access his documents and services on the go. Which of these technologies allows hi
    15·1 answer
  • 1. Which of the following is a search engine?
    6·2 answers
  • Which function of a web page relies on responsive web design? Adding extra horizontal scroll Blocking mobile devices from viewin
    11·2 answers
  • Write an expression whose value is the arithmetic sum of the int associated with x, and the all-digit str associated with s. (hi
    9·1 answer
  • What is a thesaurus is best used for​
    11·2 answers
  • Write the definition of a function printLarger, which has two int parameters and returns nothing. The function prints the larger
    7·1 answer
  • Why might you receive a tax refund from the irs
    6·1 answer
  • a. Create an Abstract class called Vehicle with abstract methods accelerate, stop, and gas, &amp; data of your choice (5 marks)
    12·1 answer
  • Display all the lines in unixPasswd that contain at least 10 consecutive lowercase letters. How many names are there in total th
    12·1 answer
  • I'm getting pretty desperate plz help me, I'll give brainiest, and ill make a free question worth 100 points this is for coding
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!