You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
357 B

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define NUM 45
int main(void)
{//srand()함수와 time()함수를 사용한 숫자 6개를 출력
int cnt;
printf("1~45 중에서 숫자 6개 출력\n");
srand((unsigned)time(NULL));
printf("srand() 출력 : ");
for (cnt = 1; cnt <= 6; cnt++)
printf("\n%d: %d", cnt, 1 + (rand() % NUM));
printf("\n");
return 0;
}