Blogger Tips And Tricks|Latest Tips For Bloggers Free Backlinks

Thursday, 15 November 2012

Write a program to find the factorial of the given number using in C language examples?

Factorial program in C,find given number factorial,find the factorial of the given number,factorial C program,given number factorial,using C find the factorial of given number,Write a program to find the factorial of the given number using in C program language,using C find factorial,C factorial,find the factorial in C language

Factorial of given number

   The below program is for Factorial of the given number

                      #include<stdio.h>
                      main()
                      {
                           int n,fact = 1;

                            printf("Enter number\n");
                            scanf("%d",&n)
;
                               while(n>1)
                                 {
                                       fact = fact*n;
                                          n--;
                                  }
                               printf("Factorial of given number is %d\n",fact);
                       }

             Output:
                           Enter number
                                6
                           Factorial of given number is 720
                      

2 comments:

  1. #include


    int fact(int n)
    {
    if(n==1)
    return 1;
    else
    return n*fact(n-1);
    }


    int main()
    {
    int n;
    printf("Enter the factorial number\n");
    scanf("%d",&n);
    printf("Factorial of %d is %d\n",n,fact(n));
    }

    ReplyDelete