[C] 알고리즘 118 - L1: Set Alarm

박진현·2021년 10월 5일
1

알고리즘 (Javascript / C)

목록 보기
118/125

Q.

Write a function named setAlarm which receives two parameters. The first parameter, employed, is true whenever you are employed and the second parameter, vacation is true whenever you are on vacation.

The function should return true if you are employed and not on vacation (because these are the circumstances under which you need to set an alarm). It should return false otherwise. Examples:

setAlarm(true, true) -> false
setAlarm(false, true) -> false
setAlarm(false, false) -> false
setAlarm(true, false) -> true

A)

#include <stdbool.h>
#include <stdlib.h>

bool set_alarm(bool employed, bool vacation) 
{
	return employed && !vacation;
}
profile
👨🏻‍💻 호기심이 많고 에러를 좋아하는 프론트엔드 개발자 박진현 입니다.

0개의 댓글