answer.
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
earnstyle [38]
2 years ago
5

Write a while loop that prints user_num divided by 2 until user_num is less than 1. The value of user_num changes inside of the

loop. Sample output with input: 20 10.0 5.0 2.5 1.25 0.625
Computers and Technology
1 answer:
WITCHER [35]2 years ago
8 0

Answer:

The code to this question can be defined as follows:

Code:

#include <stdio.h> //defining header file

int main() //defining main method

{

float user_num; //defining float variable

printf("Enter a value: "); //message

scanf("%f",&user_num); //input value from user end

printf("%f, ",user_num); //print value

while (user_num>1) //loop to calculte value

{

user_num=user_num/2; //diving value

printf("%f, ",user_num); //print value.

}

   return 0;

}

Output:

Enter a value: 20

20.000000, 10.000000, 5.000000, 2.500000, 1.250000, 0.625000,  

Explanation:

Description of the code as follows:

  • First, a float variable "user_num" is declared, in which we take input from the user-end.
  • In the next step, a while loop is declared, that uses the above variable to calculates its value.
  • Inside the loop variable "user_num" divide its value by 2 and holds its calculated value, to print its value the "printf" method is used that prints its value.  
You might be interested in
Two devices are connected to the Internet and communicating with one another. A squirrel chews through one of the wires in the n
bearhunter [10]

Answer:

Fault-Tolerance

Explanation:

Fault tolerance refers to the ability of a system (computer, network, cloud cluster, etc.) to continue operating without interruption when one or more of its components fail.

5 0
2 years ago
Mechanical advantage is the ratio of the force required to move a load divided by______
Veseljchak [2.6K]
I am not sure but i think it is 2 or 4 because a pc can withstand the power of volts, drive, ram, and data
3 0
2 years ago
2 Name the package that contains scanner class?​
Marat540 [252]
the answer is Java.util.scanner
5 0
1 year ago
The height of a small rocket y can be calculated as a function of time after blastoff with the following piecewise function: y 5
SOVA2 [1]

Answer:

High level Language

understand

Explanation:

rocket is 0...4433456u888

5 0
1 year ago
Assign max_sum with the greater of num_a and num_b, PLUS the greater of num_y and num_z. Use just one statement. Hint: Call find
Gnoma [55]

Answer:

def find_max(num_1, num_2):

   max_val = 0.0

   if (num_1 > num_2): # if num1 is greater than num2,

       max_val = num_1 # then num1 is the maxVal.

   else: # Otherwise,

       max_val = num_2 # num2 is the maxVal

   return max_val

max_sum = 0.0

num_a = float(input())

num_b = float(input())

num_y = float(input())

num_z = float(input())

max_sum = find_max(num_a, num_b) + find_max(num_y, num_z)

print('max_sum is:', max_sum)

Explanation:

I added the missing part. Also, you forgot the put parentheses. I highlighted all.

To find the max_sum, you need to call the find_max twice and sum the result of these. In the first call, use the parameters num_a and num_b (This will give you greater among them). In the second call, use the parameters num_y and num_z (This will again give you greater among them)

5 0
1 year ago
Other questions:
  • Which perspective is usually used in process simulations?
    6·1 answer
  • PYTHON QUESTION
    15·1 answer
  • Write the definition of a class Telephone. The class has no constructors, one instance variable of type String called number, an
    9·1 answer
  • Print "userNum1 is negative." if userNum1 is less than O. End with newline Convert userNum2 to 0 if userNum2 is greater than 8.
    10·1 answer
  • The PictureBook class is a subclass of the Book class that has one additional attribute: a String variable named illustrator tha
    9·1 answer
  • The fact that the speed of a vehicle is lower than the prescribed limits shall relieve the driver from the duty to decrease spee
    11·2 answers
  • Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255
    5·1 answer
  • Members of the sales team use laptops to connect to the company network. While traveling, they connect their laptops to the inte
    15·1 answer
  • Doug grew up on a large farm in southwest Wisconsin. As a college graduation gift, Doug’s father gave him several hundred acres
    6·1 answer
  • What is a key differentiator of Conversational AI? It implements Natural Language Understanding (NLU) and other human-like behav
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!