알고리즘 34 - Opposites Attract

tamagoyakii·2021년 10월 11일
0

알고리즘

목록 보기
34/89

Q.

Timmy & Sarah think they are in love, but around where they live, they will only know once they pick a flower each. If one of the flowers has an even number of petals and the other has an odd number of petals it means they are in love.

Write a function that will take the number of petals of each flower and return true if they are in love and false if they aren't.

A)

#include <stdbool.h>

bool lovefunc(int flower1, int flower2) {
	return flower1 % 2 != flower2 % 2;
}

Rank up 했다 ! 무 ~ 야 ~ 호 ~ 🎉

0개의 댓글