Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- public class Test{
- public static void main(String[] args) {
- int n = 153;
- boolean b = checkArm(n);
- if (b == true)
- System.out.println("This number is Armstrong");
- else
- System.out.println("This number is not Armstrong");
- }
- public static boolean checkArm(int n){
- int a = 0;
- int b;
- int c = n;
- while(n != 0){
- b = n% 10;
- a = a + b^3;
- n = (n-b) / 10;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement