Amstrong Number

Run Settings
LanguageJava
Language Version
Run Command
import java.util.Scanner; class Main { public static boolean isAmstrong(int n) { int c = n; int s = 0; while(n!=0) { int r = n % 10; s = s + (int)Math.pow(r,3); n = n / 10; } if( s == c ) return true; return false; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); System.out.println(isAmstrong(n)); } }
Editor Settings
Theme
Key bindings
Full width
Lines