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
Java consecutive repeated cha
1_Arpansubba_Lincoln.java
String object comparision
1.6
2A
Preference List
Validate mobile number
Hello, World!
Project Euler #2
Java recursive test