C Program - Write a program to find the factorial of a number using for loop
C Programming Language Loop control in C Language (Article) Loop control in C Language (Program)
981Program:
#include"stdio.h" int main() { int n, c; long int f=1; printf("\n Enter the number:"); scanf("%d",&n); if(n<0) goto end; for(c=1; c<=n; c++) f*=c; printf("\n FACTORIAL IS %ld", f); end: getch(); return 0; }
Output:
Enter the number:5 FACTORIAL IS 120
Explanation:
None
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.