Ask Question
10 November, 05:50

Write a while loop that will figure out the factorial of 5 (5!) and print this. It should use two integer variables (i and f) and print f at the end:

+3
Answers (1)
  1. 10 November, 08:39
    0
    void main ()

    {

    int n, i, fact=1;

    printf (""Enter the number/n"");

    scanf (""%d"",&n);

    i=num

    while (i>=1)

    {

    fact=fact * i;

    i--;

    }

    printf (""The factorial of given number %d is %d/n"", n, fact);

    return 0;

    }

    Explanation:

    This program obtains the number for which the factorial has to be found.

    Then run a for loop till the factor of 1 is calculated and inside the for loop the number is multiplied with other numbers in the descending order and finally result is printed.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a while loop that will figure out the factorial of 5 (5!) and print this. It should use two integer variables (i and f) and print f ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers