/* Declaramos Librerias, usaremos stdlib para el random */
#include
#include
#include
main()
{
int i,x,cuenta=0;
clrscr();
randomize(); /* Funcion para crear aleatorios */
/* i inicia en 1, si es igual o menor a 20 repite el ciclo y agrega 1 a i */
for (i=1;i<=20;i++)
{
/* x es igual a los aleatorios de 1 a 8, ponemos un +1 para que sean 9 */
x=random(9) +1;
printf("%d ",x);
if (x==5) /* Si x es igual a 5 (compara) */
cuenta=cuenta+1;
}
printf("\nEl 5 se genero %d veces",cuenta); /* El 5 se repite tantas veces*/
}
One of the most astonishing old town on the planet Old City of Jerusalem
-
Jerusalem is perhaps the most established city on the planet . By measuring
its history and its multifaceted nature, on the off chance that we think
about ...
Hace 5 años
0 comentarios:
Publicar un comentario