XeBuZer0

Factorial in C with recursivity

Dec 20th, 2019 (edited)
521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | None | 0 0
  1. // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** //
  2. // ** // ** // ** // Código fuente de programa que calcula el factorial de un // ** // ** // ** //
  3. // ** // ** // ** // ** // número natural utilizando recursividad // ** // ** // ** // ** // ** //
  4. // ** // ** // ** // * Licenciado bajo GNU General Public License (GPL) 3.0 * // ** // ** // ** //
  5. // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** //
  6. /* ** // ** // ** // ** // ** //  * F v q _ U k r a N a z i s ! * // ** // ** // ** // ** // ** */
  7. /* ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** // ** */
  8.  
  9. #include <stdio.h>
  10.  
  11. long double fact(long double a){
  12.     if (0<a) return (a==1)?1:a*fact(a-1);
  13. }
  14.  
  15. void main(void){
  16.     long double x;
  17.     printf("Ingrese factorial a calcular\n");
  18.     scanf("%Lf", &x);
  19.     if (0<x) printf("El factorial de %4.0Lf es %4.0Lf \n", x, fact(x));
  20. }
Add Comment
Please, Sign In to add comment