Created
September 4, 2012 12:43
-
-
Save gonzalowtf/3620849 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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