Ask Question
23 February, 23:59

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:

+5
Answers (1)
  1. 24 February, 03:28
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers