diff --git a/srand()함수와 time()함수를 사용한 숫자 6개를 출력.c b/srand()함수와 time()함수를 사용한 숫자 6개를 출력.c new file mode 100644 index 0000000..f960c97 --- /dev/null +++ b/srand()함수와 time()함수를 사용한 숫자 6개를 출력.c @@ -0,0 +1,21 @@ +#include +#include +#include + +#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("%d", 1 + (rand() % NUM)); + + printf("\n"); + return 0; + +} \ No newline at end of file