Factorial of numbers

Product of all integers less than or equal to n and greater than or equal to 1

n ! = n ( n - 1)( n - 2)( n - 3) ... (3)(2)(1)
#include <stdio.h>
int main(void){
int i;
int num;
unsigned long long fact=1;
printf("Enter the number ");
scanf("%d",&num);

for ( i=1;i<=num;i++){
fact = fact * i;
}
printf("Factorial = %llu",fact);
return 0;
}
Output is here for input 10
3628800

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2021 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer