#include <stdlib.h> #include <stdio.h> #include <time.h> |
srand((unsigned int)time(NULL)); |
printf("サイコロの出目は%dです\n",rand() % 6 + 1); |
printf("サイコロの出目は%dです\n",rand() % 6 + 1); printf("サイコロの出目は%dです\n",rand() % 6 + 1); printf("サイコロの出目は%dです\n",rand() % 6 + 1); printf("サイコロの出目は%dです\n",rand() % 6 + 1); printf("サイコロの出目は%dです\n",rand() % 6 + 1); |
![]() 実行例 |
printf("サイコロの出目は%dです\n",rand() % 6 + 1); |