Factorial Code

#include<stdio.h> int fact(int a) { if (a == 0 || a==1) return 1; return a*fact(a - 1); } int main() { int num,i; printf("Enter a number: \n"); do { scanf_s("%d", &num); } while(printf("%d!: %d\n", num, fact(num))); getchar(); getchar(); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.