import java.util.Scanner ; public class Onlydivisibleby2andnot5 { Scanner sc = new scanner(System.in); boolean divby2 = false, divby4 = false, divby5 = false; int number, lastDigit, last2Digits; System. out. println (" Enter an Integer:"); number = sc.nextInt(); lastDigit = number %10; last2Digits = number %100; if (lastDigits == 0 || lastDigit == 2 || lastDigit == 4 || lastDigit == 6 || lastDigit == 8) divby 2 = true; if (lastDigits == 0 || lastDigit == 5) divby 5 = true; if (lastDigits == 0 || lastDigit == 4) divby 4 = true; System. out. println(number +" is divisible by 2 but not 5"); } please tell me what is wrong in this java code
Answers
Answered by
0
Answer:
please check on second last line I thing something there
Answered by
0
Answer:
.
Explanation:
Similar questions