C언어
[TDD] 뽑기 프로그램 만들기
mcdn
2020. 8. 8. 16:37
반응형
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MAX_NUM 6
int main(void)
{
printf("<<lotto number generator>>\n");
printf("the number is from 1 to 45.\n");
srand(time(NULL));
for (int i =0; i< MAX_NUM; i++)
{
printf("%d ", rand() % 45 + 1);
}
printf("\n");
return 0;
}

반응형