Saturday 1 April 2017

C Program to Calculate Factorial of A Number


Program :-

#include < stdio.h >
main() {
    int n,i = 1,fact = 1;
    printf("\n enter the number :");
    scanf("%d",&n);
    for(;i < = n; i++){
        fact = fact * i ;
    }
    printf("%d!=%d",n,fact);
}

Output :-

enter the number  :  3
3! = 6


No comments:

Post a Comment

How to Invert an SVG image using CSS ?

You can invert your svg easily by using following css code svg { -webkit-filter: invert(100%); /* safari 6.0 - 9.0 */ filter...