미래(2015-2016)/자습
알람 울리는 시간 맞추기 (알람시계)
반짝반짝후크
2015. 8. 28. 13:13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* 2015.08.27 내용: 알람시간을 저장할 변수 선언 => int 타입 설정한 값이 되면 알람 울리기(알람은 printf() 함수로 출력하세요) */ #include <stdio.h> int main() { int alarm = 8; int whatTime; printf("지금은 몇 시 입니까? : "); scanf("%d", &whatTime); (whatTime == alarm) ? printf("알람이 울렸습니다. \n") : printf("알람이 울릴 시간이 아닙니다. \n"); return 0; } | cs |