interview-techdev-guide icon indicating copy to clipboard operation
interview-techdev-guide copied to clipboard

Implemented factorial in C.

Open roeey777 opened this issue 4 years ago • 2 comments

Signed-off-by: Eyal Royee [email protected]

roeey777 avatar Oct 25 '19 11:10 roeey777

It would be great if you can add the description along with the issue number. Feel free to use our contribution guidelines (https://github.com/fnplus/interview-techdev-guide/blob/master/CONTRIBUTING.md#how-to-contribute-an-implementation-code) for reference

xlogix avatar Oct 25 '19 14:10 xlogix

include <stdio.h> int main() { int n, i; unsigned long long factorial = 1; printf("Enter an integer: "); scanf("%d",&n); if (n < 0) printf("Factorial of a negative number doesn't exist."); else { for(i=1; i<=n; ++i) { factorial *= i;
} printf("Factorial of %d = %llu", n, factorial); } return 0; }

poojapatidar21 avatar Oct 26 '19 05:10 poojapatidar21