Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Armstrong
- {
- public static void main(String...s)
- {
- int m,n,i,j=0;
- n=Integer.parseInt(s[0]);
- m=n;
- while(n!=0)
- {
- i=n%10;
- j+=(i*i*i);
- n/=10;
- }
- if(j==m)
- System.out.println("\nNumber is armstrong");
- else
- System.out.println("\nNumber is not armstrong");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement