Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package p20190916;
- import oracle.jrockit.jfr.parser.FLREventInfo;
- public class NumberFinder {
- static boolean isEven(int a) {
- if (a % 2 == 0)
- return true;
- else
- return false;
- }
- static boolean isPalindrome(int b) {
- int remainder, reversedInteger = 0, originalInteger;
- originalInteger = b;
- while (b != 0) {
- remainder = b % 10;
- reversedInteger = reversedInteger * 10 + remainder;
- b = b / 10;
- }
- if (originalInteger == reversedInteger)
- return true;
- else
- return false;
- }
- static boolean isArmstrong(int c) {
- int remainder, originalInteger, result = 0;
- originalInteger = c;
- while (c != 0) {
- remainder = c % 10;
- result = result + (remainder * remainder * remainder);
- c = c / 10;
- }
- c = originalInteger;
- if (c == result)
- return true;
- else
- return false;
- }
- static boolean isStrong(int d) {
- int remainder, originalInteger, fact, result = 0;
- originalInteger = d;
- fact = 1;
- while (d > 0) {
- remainder = d % 10;
- for (int i = remainder; i >= 0; i--) {
- fact = fact * i;
- }
- result = result + fact;
- d = d / 10;
- }
- d = originalInteger;
- if (d == result)
- return true;
- else
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement