-
Lenguaje
C
-
Descripción
Mustra el factorial de un número entero positivo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
int i, numero;
long factorial = 1;
printf ("Ingrese un n\243mero: ");
scanf ("%d", &numero);
printf ("\n%d! = 1", numero);
for (i=2; i<=numero; i++)
{
factorial *= i;
printf (" \236 %d", i);
}
printf (" = %ld\n\n", factorial);
system ("pause");
return EXIT_SUCCESS;
}
#include <stdlib.h>
int main (void)
{
int i, numero;
long factorial = 1;
printf ("Ingrese un n\243mero: ");
scanf ("%d", &numero);
printf ("\n%d! = 1", numero);
for (i=2; i<=numero; i++)
{
factorial *= i;
printf (" \236 %d", i);
}
printf (" = %ld\n\n", factorial);
system ("pause");
return EXIT_SUCCESS;
}