Q:

Write a program in c++ to find the factorial of a number after reading it

0

Write a program in c++ to find the factorial of a number after reading it

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>

using namespace std;

int main()
{
    int number,factorial=1;
    cout<<"please enter the number: ";
    cin>>number;
    while(number>=1)
    {
        factorial=factorial*number;
        number--;
    }
    cout<<"factorial is : "<<factorial;
    return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now