Showing posts with label c program to find factorial of number. Show all posts
Showing posts with label c program to find factorial of number. Show all posts

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


Algorithm to Calculate Factorial of A Number


Step 1 : Start
Step 2 : Read Number ,Set i = 1, Factorial = 1
Step 3 : if  i < = Number then go to Step 4
             else go to Step 7
Step 4 : Factorial = Factorial * i
Step 5 : Increment i 
Step 6 : go to Step 3
Step 7 : Print Factorial
Step 8 : Stop 

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...