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
Google’s adwords system provides a quality score as a measure of _____, which indicates the usefulness of an ad message to consu
Vanyuwa [196]
The term that best fit the blank is RELEVANCE. The Google Adwords system is a system that is created by Google for the purpose of advertising online. Therefore, relevance is very important in this aspect as this shows how useful the ad is to the consumers who are doing the google search.
3 0
2 years ago
What is the name of the first practical asymmetric cryptosystem that was created?
victus00 [196]

Answer:

I think the name is RSA

4 0
3 years ago
What is not a benefit of exploring tabs and groups in Microsoft Word?
MrRa [10]
Microsoft's<span> direct participation </span>not<span> only assures you that MOAC textbook content is accurate and current</span>
8 0
3 years ago
Read 2 more answers
What is the most useful advantage of social media in an emergency response effort?
gladu [14]
Being able to communicate directly with constituents.

ability to build situational awareness speed in which information can be delivered directly to the public
4 0
3 years ago
1. What is wrong with the following code?
uranmaximum [27]

Answer:

Aye dog I don't know nothing about code, yes its true, but I hope that you get an answer for you!

Explanation:

Facts...

5 0
3 years ago
Other questions:
  • In the Happy Valley School System, children are classified by age as follows: less than 2, ineligible 2, toddler 3-5, early chil
    6·1 answer
  • What are the pros and cons of editorial anonymity?
    13·1 answer
  • The source code of a java program is first compiled into an intermediate language called java ____, which are platform-independe
    8·1 answer
  • Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed
    13·1 answer
  • How many answers do you need to be able to write messages on here??
    6·1 answer
  • Study the sentences below. A.Changing the properties of characters in a sentence or paragraph in a Word document helps increase
    5·2 answers
  • FOR DIGITAL DESIGN/ PHOTOGRAPHY
    5·2 answers
  • Your network has been having problems lately when users are participating in video conferences - the video and audio stutters ve
    13·1 answer
  • Assignment 10 - 1/0 Streams and Files Create a C++ a program that will compute the average word length (average number of charac
    13·1 answer
  • Write a short note on Ms - Excel...​..
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!