Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Armstrong Number in Java
import java.util.Scanner; class Rextester { public static void main(String args[]) { int n = new Scanner(System.in).nextInt(), sum = 0; int x = n; while(n > 0) { sum += (n % 10) * (n % 10) * (n % 10); n /= 10; } if(sum == x) System.out.println("Armstrong number."); else System.out.println("Not an armstrong number."); } } // PROGRAM BY 'JAMES COLLINS'
run
|
edit
|
history
|
help
0
Area of the triangle
Palindrome String Checking
Problem_OnOff
parameter const
Binary Tree Max path Sum
2(B).
3rd
H
moneda
arithematic