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]
2 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]2 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
A personal career profile for can be used to match what you know about yourself to what you know about different careers
mel-nik [20]

Answer:

B

Explanation:

give answers next time pls so i can help you!!

3 0
3 years ago
Read 2 more answers
Which statement describes the relationship between science and technology?
Elden [556K]
Answer: science is the study of the world, and technology changes the world to solve problems.
3 0
2 years ago
Read 2 more answers
A cell has an unlimited number of conditions for Conditional Formatting.<br> A.true<br> B.false
Mekhanik [1.2K]
I believe the answer is false.
I Hope this helps! :)
If you don't understand plz message me
If you do plz brainlest
Thank you!
7 0
3 years ago
4.8% complete this is a single choice question; skip ahead to question content a b c d confirm difficulty level: moderate an int
PilotLPTM [1.2K]

Answer:

A replay attack

4 0
2 years ago
PLEASE HELP ASAP!!
inn [45]
The answer is encryption

steganography would be hiding data, like in an image
digital forensics is the analysis done after an attack
and the last one is a security standard
6 0
2 years ago
Other questions:
  • Create a function average_temp(s) that accepts a file name s that contains temperature readings. Each line in the file contains
    15·1 answer
  • What information is required for a complete citation of a website source?
    8·2 answers
  • When sending an electronic cover letter, an e-mail address is sufficient contact information.
    10·2 answers
  • X = 0
    15·1 answer
  • How do Web browsers interact with URL/URIs to navigate the internet
    14·1 answer
  • Please write a code for below:
    9·1 answer
  • MS Excel is a powerful spreadsheet program that helps people with complex mathematical calculations. In what ways could you use
    10·1 answer
  • What is the multiple source test
    15·1 answer
  • ravi met few peoples in a party and was mixing up well those wearing expensives clothing and fair complexion . which factors are
    9·1 answer
  • In cell N2, enter a formula using the IF function and structured references as follows to determine which work tier Kay Colbert
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!