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
Reading log of any book with page numbers​
Ostrovityanka [42]

Answer:

index

Explanation:

its in the index?

6 0
3 years ago
Do like TikTok??????
OlgaM077 [116]

Answer: you should it’s addicting

!!!! ?”!!!!

Explanation:

8 0
3 years ago
Read 2 more answers
According to the author, there are five hedging strategies organizations can pursue. One of them is: Select one: a. commit with
Kitty [74]

Answer:

The correct answer is letter "A": commit with fallback.

Explanation:

American Professor Alfred A. Marcus (born 1950) in his book "<em>The Future of Technology Management and the Business</em>" (2015) describes that hedging may be a strategy to shield businesses from the rapidly evolving world they face as a result of the continuous implementation of technology in the market. According to Marcus, there are 5 hedge approaches that firms should implement:

  1. Gamble on the most probable:<em> work on the product with the highest success rate. </em>
  2. Take the robust route: <em>invest in as many products as possible. </em>
  3. Delay until further clarity emerges:<em> waiting for a proper moment to react in front of market changes. </em>
  4. <u>Commit with a fallback</u>:<em> adapt according to the market. </em>
  5. Try to shape the future:<em> innovate.</em>
7 0
4 years ago
To select a number format, you can choose a category in the Number tab in the Format Cells dialog box and then select the number
siniylev [52]

Answer:

1.true

Explanation:

6 0
3 years ago
True or False: At the Company level, users will only have access to view projects to which they have been specifically granted a
Viktor [21]

Answer:here the link

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Computer hardware had been designed to run a single operating system and a single app, leaving computers vastly underutilized. o
    15·1 answer
  • In the lan protocol architecture the _________ layer is responsible for detecting errors and discarding any frames that are in e
    13·1 answer
  • Given that two int variables, total and amount, have been declared, write a sequence of statements that: initializes total to 0
    14·1 answer
  • Was the type writer the first part of the keyboard? ​
    8·1 answer
  • Can you make copies of classified documents provided you alert others?
    6·1 answer
  • A noisy signal has been uploaded to D2L in the files fft_signal.mat and fft_signal.txt.Write a program to estimate the power spe
    10·1 answer
  • Why is it so important to adhere to principles that have been put forth by reputable organizations to ensure that you are mainta
    10·1 answer
  • Disuss the roles of hardware,software and databases in regard to computer based information systems
    7·1 answer
  • What statement best describes entrepreneurship?
    7·2 answers
  • Simple interest will always pay more interest than compound interest.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!