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
_____ allow you to resize a graphic using the mouse.
timofeeve [1]
Microsoft.././/.//././././././.
5 0
3 years ago
Read 2 more answers
Write a loop that finds the sum of the numbers between 7 and 34
Westkost [7]

THIS IS FOR PYTHON

total = 0

for i in range(7, 35):

   total += i

   print(i)

print(total)

I forgot the reason but python always stops one number before your desired value. So that's why it's 35

7 0
2 years ago
Best location to install a patch panel?
sergejj [24]

Answer:

Explanation: In general, there are three positions for the patch panel to install in the stand column of rack, which depends on your cabling. When adopting ground outlet, the cables usually enter inside the rack from its bottom. So the patch panel should be mounted in the lower part inside the rack.

8 0
2 years ago
With theuse of which of the following, we reason from a generalization to aspecific conclusion?
nirvana33 [79]

Answer:

d-Deduction

Explanation:

<u>Deduction</u>

In deductive inference, we maintain a hypothesis and we predict its implications on the basis of it. That is, we predict what the results should be if the theory were right. We go from the general theory to the particular observations.

<u>Induction</u>

We're going from the specific to the general inductive inference. We make a lot of observations, discern a pattern, generalize and infer an explanation or theory.

<u>Analogy</u>

An analogy is a comparison between two objects or object systems, highlighting the respects in which they are considered to be similar.

<u>Logic</u>

Science dealing with the principles and criteria of validity of inference and demonstration that is science of formal rules of reasoning.

7 0
3 years ago
A python program that asks the user for four numbers and prints out the first and last number. It must have an array used in it.
Ksju [112]

Answer:

numbers = []

for i in range(4):

 z = int(input("enter a number: "))

 numbers.append(z)

print("First is {} and last is {}".format(numbers[0], numbers[-1]))

Explanation:

Now I understand your other question as well! ;-)

7 0
3 years ago
Other questions:
  • ‘The increased availability of mobile digital devices has had a positive impact on how young people use their free time’. Make a
    14·2 answers
  • Write a program that prints the block letter “B” in a 7x7 grid of stars like this:
    13·1 answer
  • when you cross or enter traffic from a full stop, how much space should you allow on city streets? on the highway?
    11·1 answer
  • The command to delete all the files that have filenames that starts with letter c or c and ends with a letter z or z is
    15·1 answer
  • Which of the following best define grit
    13·1 answer
  • Danielle, a help desk technician, receives a call from a client. In a panic, he explains that he was using the Internet to resea
    9·1 answer
  • In Access, it is possible to have _______________ fields, that is, fields that can contain more than one value.
    9·1 answer
  • Peripeteia is also referred to as __________.
    5·2 answers
  • ​________________________ are the main forms of direct and digital marketing. A. Mobile​ marketing, social media​ marketing, and
    5·1 answer
  • How to do the for loop in python
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!