fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Armstrong
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int n=Integer.parseInt(args[0]);
  13. int ans=0;
  14.  
  15. while(n>0)
  16. {
  17. x=n%10;
  18. n=n/10;
  19. ans=ans+(x*x*x);
  20. System.out.println( "armstrong number="+ans);
  21. }
  22. // your code goes here
  23. }
  24. }
Compilation error #stdin compilation error #stdout 0.06s 3359744KB
stdin
Standard input is empty
compilation info
Main.java:17: error: cannot find symbol
			x=n%10;
			^
  symbol:   variable x
  location: class Armstrong
Main.java:19: error: cannot find symbol
			ans=ans+(x*x*x);
			         ^
  symbol:   variable x
  location: class Armstrong
Main.java:19: error: cannot find symbol
			ans=ans+(x*x*x);
			           ^
  symbol:   variable x
  location: class Armstrong
Main.java:19: error: cannot find symbol
			ans=ans+(x*x*x);
			             ^
  symbol:   variable x
  location: class Armstrong
4 errors
stdout
Standard output is empty