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
What infrastructure model provides access to shared computing resources over a network, often the internet?
Goshia [24]
Cloud computing infrastructure model provides access to shared computing resources over a network, often the internet. The cloud computing infrastructure is a virtual infrastructure composed of hardware and software components <span>needed to support the </span>computing<span> requirements of a </span>cloud computing model.And the cloud computing model is <span>the delivery of computing services (servers, storage, databases, networking, software, analytics and more) over the Internet .</span> 
7 0
2 years ago
Compare the encryption algorithms found in s-tools: idea, mdc, des, and 3des.
grin007 [14]
Are their answer chocies 

3 0
2 years ago
Match each logical function with its description. AND COUNTIF SUMIF IF tests for a certain condition and returns one of two valu
lakkis [162]
1. IF
2. AND
3. COUNTIF
4. SUMIF
4 0
2 years ago
Mary has been locked out of her account after failing to correctly enter her password three times. As the system administrator,
Digiron [165]
Oh hey lol yea yea lol I got the money back to me put on the phone so you know
7 0
2 years ago
When looking at security standard and compliance, which three (3) are characteristics of best practices, baselines and framework
Brilliant_brown [7]

Answer:

In order to observe best practices, and to meet with technical and other requirements, organizations often use frameworks for cybersecurity compliance and regulatory compliance. These frameworks provide best practices and guidelines to assist in improving security, optimizing business processes, meeting regulatory requirements, and performing other tasks necessary to achieve specific business objectives such as breaking into a particular market niche or selling to government agencies.

Many such frameworks exist, and the recommendations set out in them can impose difficult and often expensive demands on enterprise resources – especially in situations where an organization is subject to a number of regulatory compliance regimes, whose requirements it has to meet while maintaining its own strong cybersecurity status.

Explanation:

4 0
2 years ago
Other questions:
  • 14. If B3=10 and D5=8, what would the following function return? IF(B3&gt;D5, "Closed", D5-B3) *
    9·1 answer
  • Your reputation and credibility will be immediately destroyed if your website contains?
    8·2 answers
  • Graduating from college can boost your income 60% compared to high school graduates. An average high school graduate without a c
    8·1 answer
  • Consider two vectors that are NOT sorted, each containing n comparable items. How long would it take to display all items (in an
    8·1 answer
  • Design and implement an algorithm that gets as input a list of k integer values N1, N2,..., Nk as well as a special value SUM. Y
    12·1 answer
  • In an executing process, the program counter points __________.
    15·1 answer
  • Write a method so that the main() code below can be replaced by simpler code that calls method calcMilesTraveled(). Original mai
    11·1 answer
  • 2. BIOS is contained in ROM and not in RAM. Can you guess why?​
    15·1 answer
  • A data analyst is using the Color tool in Tableau to apply a color scheme to a data visualization. They want the visualization t
    13·1 answer
  • Which of the following statement is False? 1 point Context free language is the subset of context sensitive language Regular lan
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!