Question:

write a program in c to determine the factorial of given number

by Guest580  |  8 years, 2 month(s) ago

0 LIKES UnLike

write a program in c to determine the factorial of given number

 Tags: determine, factorial, Program, write

   Report

2 ANSWERS

  1. Guest5094
    #include<stdio.h>
    main()
    {
    int a, fact;
    printf("\nEnter any number: ");
    scanf ("%d", &a);
    fact=rec (a);
    printf("\nFactorial Value = %d", fact);
    }
    rec (int x)
    {
    int f;
    if (x==1)
    return (1);
    else
    f=x*rec(x-1);
    return (f);
    }

  2. Guest8877
    #include <stdio.h>
    #include<conio.h>


    void main()

    {
       int i,j,n;

       clrscr();

        printf("Enter the Number for factorial:");
        scanf("%d",&n);
        j=1;

        for (i=1; i<=n; i++)

           j=j*i;

        printf("The factorial of %d is %d\n",n,j);
        getch();

    }
Sign In or Sign Up now to answser this question!

Question Stats

Latest activity: 9 years, 4 month(s) ago.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions