Skip to content

Instantly share code, notes, and snippets.

@gonzalowtf
Created September 4, 2012 12:43
Show Gist options
  • Save gonzalowtf/3620849 to your computer and use it in GitHub Desktop.
Save gonzalowtf/3620849 to your computer and use it in GitHub Desktop.
// programa 41
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(int argc , char* argv[])
{
int dado, valor,m;
long int c=0;
srand(time(NULL));
printf("este es un juego de dados\n mostrara la cantidad de tiros que se realizo y el valor par que hizo que se detengan lo lanzamientos");
while(c<10000)
{
dado= 1+ (rand()%5);
m=dado%2;
if(m==0){
valor=dado;
break;
}
else continue;
c++;
}
printf(" el valor que detuvo los tiros fue: \n%d\n y la cantidad de tiros relizados fue:\n%d" , valor,c);
fgetc(stdin);
fgetc(stdin);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment