Advertisement
ahori

Java file bug..

Oct 24th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. package test;
  2.  
  3. public class Test{
  4.     public static void main(String[] args) {
  5.         int n = 153;
  6.         boolean b = checkArm(n);
  7.         if (b == true)
  8.             System.out.println("This number is Armstrong");
  9.         else
  10.             System.out.println("This number is not Armstrong");
  11.        
  12.     }
  13.  
  14.  
  15.     public static boolean checkArm(int n){
  16.  
  17.         int a = 0;
  18.         int b;
  19.         int c = n;
  20.        
  21.         while(n != 0){
  22.             b = n% 10;
  23.             a = a + b^3;
  24.             n = (n-b) / 10;
  25.         }
  26.        
  27.         return false;
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement