Skip to content

Instantly share code, notes, and snippets.

@wlensinas
Last active May 22, 2021 16:48
Show Gist options
  • Save wlensinas/751f4d0e274ceb36f1ca2b03a4079622 to your computer and use it in GitHub Desktop.
Save wlensinas/751f4d0e274ceb36f1ca2b03a4079622 to your computer and use it in GitHub Desktop.
Get Random number in C between 0 and 100
#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