Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

C for loop factorial value (incrementation)

#include<stdio.h>
main()
{
    int n,f,i;
    printf("Enter a number: ");
    scanf("%d",&n);
        printf("
");
        printf("Formula: ");
    f=1;
        for(i=1;i<n;i++)
        {
    	    printf("%d*",i);
    	    f=f*i;
        }
            f=f*i;
            printf("%d",i);
                printf("
The factorial value: %d",f);
}
Source by www.shafaetsplanet.com #
 
PREVIOUS NEXT
Tagged: #C #loop #factorial
ADD COMMENT
Topic
Name
1+4 =