#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
srand(time(NULL)); //난수 초기화
int rand1 = rand() % 6 + 1; //1~6
printf("%d", rand1);
int i;
for(i=1;i<=10;i++){
printf("%d ", rand() % 100);
}
printf("\n");
int rand2 = rand() % 3;
switch(rand2){
case 0:
printf("가위");
break;
case 1:
printf("바위");
break;
case 2:
printf("보");
break;
default:
return 0;
}
printf("\n");
int rand3 = rand() % 3;
if(rand3 == 0){
printf("가위");
}else if(rand3 == 1){
printf("바위");
}else if(rand3 == 2){
printf("보");
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: