Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Magic No.
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int i,j,s=0,d,n=272; while (s!=1) { d=n%10; s=s+d; n=n/10; if (s==1) { System.out.println("Magic no."); break; } else if (n==0) n=s; if (s!=0) { System.out.println("Not Magic"); break; } } } }
run
|
edit
|
history
|
help
0
stream handlingException
Value pair analysis
2D List Iterator
Java messing around
3e
Java Switch
Greedy algo Activity program
Circular array Loop?
Loop from 5 to 15
Problem_OnOff