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
adell [148]
3 years ago
11

Write a program that lets the user enter a nonnegative integer then uses a loop to calculate the factorial of that number. Displ

ay the factorial.
Computers and Technology
1 answer:
ValentinkaMS [17]3 years ago
3 0

Answer:

Following are the program in c++ language

#include <iostream> // header file

using namespace std;// namespace

int main() // main function

{

    int num; // variable declaration

    long int f=1; // variable declaration

   do

   {

       cout<<"Enter the Positive value:";

       cin>>num;

   } while(num<0); // i check whether   number is non negative or not

   while(num>0) // iterating over the loop

   {

       f=f*num; // calculate the factorial

       num--; // decrement the value of num by 1

   }

   cout<<" factorial is :"<<f; // display the factorial .

   return 0;

}

Output:

Enter the Positive value:7

factorial is :5040

Explanation:

Following are the description of the program .

  • Read the input by user in the "num" variable of "int" type..
  • The do-while will check the enter number is nonnegative number.  
  • While(n>0) loop is calculating the factorial in the  "f" variable .
  • Finally display the factorial .  
You might be interested in
You are installing an updated driver for a hardware device on your system. A dialog box displays indicating that Microsoft has d
inessss [21]

Answer:

It means the driver has been tested by Microsoft, and its an unaltered file.

Explanation:

A signed driver ensures that comes directly from Microsoft, it hasn't been modified by any other group or otherwise would lose the signature,  the driver is associated with a digital certificate that allows Windows to test its authenticity.

Since drivers work at very high-security levels on Windows OS, installing unsigned drivers it's a considerable risk.

7 0
3 years ago
In Python, when do we use the str( ) function
pav-90 [236]

Answer:

Both str () and repr () methods in python are used for string representation of a string.

Explanation:

Though they both seem to serve the same purpose, there is a little difference between them. Have you ever noticed what happens when you call a python built-in function str (x) where x is any object you want?

7 0
2 years ago
Is a system software that manages the hardware resources and provides services 5o the application software
Alborosie

Answer:

"Operating system" is the right response.

Explanation:

  • The key program collection on something like a computer device that maintains it interacts mostly with underlying hardware of that system is considered as an Operating system.
  • Even without the need for an OS, every consumer isn't able to access either equipment, monitor as well as portable phone or devices.
8 0
3 years ago
Where would you click to change the<br><br>Screen Saver?​
ycow [4]

Answer:

Explanation:

Go to Settings > Personalization > Lock screen, and select Screen saver settings. In the Screen Saver Settings window, choose a screen saver from the drop-down list.

8 0
3 years ago
Read 2 more answers
I plugged my headphones into my computer, but the sound still came out of the speakers. help!
VARVARA [1.3K]

If you mean speakers. You should remove them or if you mean the speakers in the PC. Perhaps you put the headphones in the wrong one. Theres usually too one in the front and the other one in the back of the desktop.





Hope this helps.


Regards. Shaggy


Enjoy your music!

3 0
3 years ago
Read 2 more answers
Other questions:
  • A coordinated collection of fonts,colors,and other viscal effects is called
    10·1 answer
  • What does a graphic organizer do
    6·1 answer
  • Write the following method to display three numbers in increaseing order:
    5·1 answer
  • Implement function translate() that provides a rudimentary translation service. The function input is a dictionary mapping words
    9·1 answer
  • A​ client-server application that requires nothing more than a browser is called​ ________.
    8·2 answers
  • Chevening is looking for individuals with strong professional relationship building skills, who will engage with the Chevening c
    15·1 answer
  • How do you guys feel about the coronavirus and being Homeschooled
    10·1 answer
  • In the context of the planning phase of the systems development life cycle (SDLC), which is an example of an internally identifi
    6·1 answer
  • Given the following code, assume the myStack object is a stack that can hold integers and that value is an int variable. Assume
    8·1 answer
  • 3. Find the best.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!