C Program : Factorial Program using loop C Language Knowledge Based Info. #include<stdio.h> int main(){ int i,fact=1,number; printf("Enter a number: "); scanf("%d",&number); for(i=1;i<=number;i++){ fact=fact*i; } printf("Factorial of %d is: %d",number,fact); return 0; } Output: Enter a number: 5 Factorial of 5 is: 120 Share this Share on FacebookTweet on TwitterPlus on Google+
EmoticonEmoticon