Last active
May 22, 2021 16:48
-
-
Save wlensinas/751f4d0e274ceb36f1ca2b03a4079622 to your computer and use it in GitHub Desktop.
Get Random number in C between 0 and 100
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
int main() | |
{ | |
time_t tiempo = time(NULL); | |
int r = 0; | |
int opcion = 0; | |
srand(tiempo); | |
do { | |
r = rand() % 101; | |
printf("Su numero de la suerte es: %d\n", r); | |
printf("Quiere otro numero? ingrese 1:"); | |
scanf("%d", &opcion); | |
} while (opcion == 1); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment