Problem:
Return true if the given non-negative number is 1 or 2 more than a multiple of 20. See also: Introduction to Mod
more20(20) → false
more20(21) → true
more20(22) → true
Solution:
public boolean more20(int n) { return (n % 20) == 1 || (n % 20) == 2; }
شكرااااااااااا
ReplyDeletewhat
Deletelmao
ReplyDeletepublic boolean more20(int n) {
ReplyDeleteint a=n%20;
return a<3&&a!=0;
}
if(n%20 == 1 || n%20 == 2)
ReplyDeletereturn true;
else
return false;