Respuesta :

Answer:

The program to this question can be describes as follows:

Program:

#include <iostream> //defining header file

using namespace std;

int main() //defining main method

{

float user_num ;//defining float variable

cout<<"Enter any number: "; //message

cin>>user_num; //input value from the user

while (user_num >= 1) //defining loop to calculate value

{

user_num =user_num/ 2; //diving the value

cout<<user_num<<endl; //print value

}

return 0;

}

Output:

Enter any number: 20

10

5

2.5

1.25

0.625

Explanation:

In the above program, a float variable user_num is declared in which we store input value from the user end, in the next step, a while loop is declared, which calculates, the given value.

  • In the loop a condition is defined, that user_num value is greater than equal to 1, inside the loop it will divide the value of the user_num and store in this variable.
  • In this print, the method is used, which prints its variable values.