#include <stdio.h>

int main() {
    // 삼항 연산자 : 한 줄로 조건문 만들기
    // 조건식 ? 값1 : 값2 
    // 조건이 참이면 값1, 조건이 거짓이면 값2

    printf("%s\n", 5 > 10 ? "참" : "거짓");

    int score = 100;
    printf("%s\n", score >= 60 ? "합격" : "불합격");

    int a = 5, b = 9;
    int max = (a > b) ? a : b;
    printf("더 큰 값은 %d\n", max);

    //문제1
    int x = 3, y = 10;
    printf("%s\n", ((x * 2 + y) > 15) ? "A" : "B");

    //문제2 : c가 60 이상이고 d가 80 미만이면 1, 아니면 0
    int c = 70, d = 70;
    printf("%d\n", c >= 60 && d < 80 ? 1 : 0);
    
    
    return 0;
}

Embed on website

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