IHYPRESS.NET
C
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Earn Free Bitcoin
CAdvanced Functions ❯ Recursive Factorial
<06.13>
#include <stdio.h> int factorial (int n) { int ans; if (n == 0) ans = 1; else ans = n * factorial(n - 1); return (ans); } int main (void) { int a, result; printf ("Enter an integer number: "); scanf ("%d", &a); /* calling the function */ result = factorial (a); /* printing the report */ printf ("The factorial of %d is %d.\n", a, result); return (0); }
Hergestellt in Deutschland / Made in Germany
Enter an integer number: 6 The factorial of 6 is 720.
COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.