
Carlos Santaniello
Preguntastudent•hace 5 años
Me está generando éste error al momento de compilar:
recursividad.c: In function ‘main’: recursividad.c:16:9: warning: too many arguments for format [-Wformat-extra-args] scanf("$d", &n); ^~~~
Adjunto código fuente:
#include<stdio.h> long result; int n; long factorial(int n){ if (n == 0) return 1; else return (n*factorial(n-1)); } int main(int argc, char const *argv[]) { printf("Ingrese el numero a calcular\n"); scanf("$d", &n); if (n < 0) { printf("El numero debe ser positivo\n"); } else { result = factorial(n); printf("%d! = %ld\n", n, result); } return 0; }

Danelia Sanchez Sanchez
student•hace 5 años
En la función
scanf
%
scanf("%d", &n);