Desc :
Source Code :
#include <stdio.h>
void main()
{
int i, randnum;
srand(time(NULL));
for (i = 0; i < 10; i++)
{
randnum = rand() % 30 + 21; // 21~51
printf("[%d]\n", randnum);
}
}
Result :
'C' 카테고리의 다른 글
[C] 208 정수를 16진수로 바꾸기 itoa() (1) | 2021.02.06 |
---|---|
[C] 207 변수의 번지 출력하기 (1) | 2021.02.06 |
[C] 205 1~100까지 홀수의 합 (1) | 2021.02.06 |
[C] 204 홀수/짝수 구분하기 (1) | 2021.02.04 |
[C] 203 삼각형 출력 (1) | 2021.02.04 |