首页 > 其他分享 >Opposites Attract

Opposites Attract

时间:2022-08-25 08:22:06浏览次数:68  
标签:love int number petals they Opposites flower1 Attract

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.

public class OppositesAttract {

  public static boolean isLove(final int flower1, final int flower2) {
    return (flower1+flower2)%2==1;
  }
}

标签:love,int,number,petals,they,Opposites,flower1,Attract
From: https://www.cnblogs.com/ukzq/p/16622999.html

相关文章