#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int main() {
    // rand() % 3; //0~2까지의 수 중 무작위로 생성
    // rand() % 3 + 1; //1~3까지의 수 중 무작위로 생성
    // srand(time(NULL)); //난수 초기화
    // printf("%d\n", rand() % 3);

    //주사위 만들기
    char TorF[10];
    int num;
    printf("주사위를 굴리겠습니까? y/n\n");
    scanf("%s", TorF);

    if(strcmp(TorF, "y") == 0){
        srand(time(NULL));
        num = rand() % 6+1;
        printf("%d\n", num);
    }

    if(num == 6){
        printf("운이 정말 좋으시네요!!🤤\n");
    }else if(num == 1 || num == 2 || num == 3){
        printf("아쉽네요...😒\n");
    }else{
        printf("운이 좋으시네요😊\n");
    }

    // int n = rand() % 30;
    // int n = rand() % 30+1;
    // int n = rand() % 31+1;
    // int n = rand() % 31;

    // int n = 2;
    // if (n==1){
    //     printf("사과");
    // }else if(n==2){
    //     printf("고구마");
    // }else{
    //     printf("귤");
    // }
    
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: