Advertisement
shawonrog

Armstrong

Feb 19th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. package basicjavalipu2;
  2. import java.util.Scanner;
  3. class BasicJavaLipu2{
  4. public static void main(String args[]){
  5. Scanner in = new Scanner(System.in);
  6. int r,sum=0,temp;
  7. int n= in.nextInt();
  8.  
  9. temp=n;
  10. while(n>0){
  11. r=n%10;
  12. sum=(sum*10)+r;
  13. n=n/10;
  14. }
  15. if(temp==sum)
  16. System.out.println("Armstrong number ");
  17. else
  18. System.out.println("not Armstrong");
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement