«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
관리 메뉴

printf("ho_tari\n");

dice 본문

C

dice

호타리 2023. 8. 31. 14:42
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void)

{
	srand(time(NULL));   // seed

	for (int i = 1; i <= 10; ++i)
    {
		int num = rand() % 6 + 1;      // random number
		printf("%d\n", num);

	}

	return 0;

}

<compile 결과>

'C' 카테고리의 다른 글

fahr2celsius  (0) 2023.08.31
factorial  (0) 2023.08.31
compareOp  (0) 2023.08.31
circle  (0) 2023.08.31
celsius2fahr  (0) 2023.08.31