Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* CABEÇALHO
- Arquivo: LISTA 03 - Exercicio 16.c
- Objetivo: Exiba uma lista com 40 grupos(cada grupo possui 3 numeros em ordem crescente) de numeros sorteados de 0 a 59 .
- Autor(a): Ramon Borges
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main()
- {
- int i, j, geradorNum, num1 = 0, num2 = 0, num3 = 0;
- srand(time(NULL));
- for(i = 1; i <= 40; i++)
- {
- for(j = 1; j <= 3; j++)
- {
- geradorNum = rand() % 60;
- if(geradorNum >= num1)
- num1 = geradorNum;
- else if(geradorNum >= num2)
- num2 = geradorNum;
- else if(geradorNum >= num3)
- num3 = geradorNum;
- }
- printf(">>> %d %d %d \n", num3, num2, num1);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment