본문 바로가기

코딩테스트/Coding Bat

[코딩뱃] [자바] Warmup - 1단계 : or35 문제

728x90
728x90

https://codingbat.com/prob/p112564

 

CodingBat Java Warmup-1 or35

Return true if the given non-negative number is a multiple of 3 or a multiple of 5. Use the % "mod" operator -- see Introduction to Mod

codingbat.com



= 문제 번역 =

음수가 아닌 주어진 숫자가 3의 배수이거나 5의 배수이면 true를 반환합니다. 

% "mod" 연산자를 사용해서 문제를 푸세요!

 

= 해설 =

< 1 >
public boolean or35(int n) {
  if(n%3==0||n%5==0){
    return true;
  }else return false;
}

728x90