fork download
  1. //What went wrong with this code?
  2.  
  3. public class Program
  4. {
  5. public static void main(String[] args) {
  6. int c=0,a,temp;
  7. int n=153;
  8. temp=n;
  9. while(n>0)      {      
  10. a=n%10;   
  11. n=n/10;    
  12. c=c+(a*a*a);
  13. }      
  14. if(temp==c){
  15. System.out.println("Armstrong");
  16. }
  17. else{
  18. System.out.println("Not Armstrong");
  19. }
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:6: error: illegal character: '\u00a0'
    int?c=0,a,temp;
       ^
Main.java:6: error: not a statement
    int?c=0,a,temp;
    ^
Main.java:6: error: ';' expected
    int?c=0,a,temp;
           ^
Main.java:6: error: not a statement
    int?c=0,a,temp;
            ^
Main.java:6: error: ';' expected
    int?c=0,a,temp;
             ^
Main.java:6: error: not a statement
    int?c=0,a,temp;
              ^
Main.java:7: error: illegal character: '\u00a0'
    int?n=153;
       ^
Main.java:7: error: not a statement
    int?n=153;
    ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
              ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
               ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
                ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
                 ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
                  ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
                   ^
Main.java:9: error: ';' expected
    while(n>0)??????{??????
                    ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
                     ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
                      ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
                       ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
                        ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
                         ^
Main.java:9: error: illegal character: '\u00a0'
    while(n>0)??????{??????
                          ^
Main.java:10: error: illegal character: '\u00a0'
        a=n%10;???
               ^
Main.java:10: error: illegal character: '\u00a0'
        a=n%10;???
                ^
Main.java:10: error: illegal character: '\u00a0'
        a=n%10;???
                 ^
Main.java:11: error: illegal character: '\u00a0'
        n=n/10;????
               ^
Main.java:11: error: illegal character: '\u00a0'
        n=n/10;????
                ^
Main.java:11: error: illegal character: '\u00a0'
        n=n/10;????
                 ^
Main.java:11: error: illegal character: '\u00a0'
        n=n/10;????
                  ^
Main.java:13: error: illegal character: '\u00a0'
        }??????
         ^
Main.java:13: error: illegal character: '\u00a0'
        }??????
          ^
Main.java:13: error: illegal character: '\u00a0'
        }??????
           ^
Main.java:13: error: illegal character: '\u00a0'
        }??????
            ^
Main.java:13: error: illegal character: '\u00a0'
        }??????
             ^
Main.java:13: error: illegal character: '\u00a0'
        }??????
              ^
Main.java:14: error: illegal start of type
    if(temp==c){
    ^
Main.java:14: error: <identifier> expected
    if(temp==c){
           ^
Main.java:14: error: ';' expected
    if(temp==c){
             ^
Main.java:14: error: illegal start of type
    if(temp==c){
              ^
Main.java:14: error: <identifier> expected
    if(temp==c){
               ^
Main.java:14: error: ';' expected
    if(temp==c){
                ^
Main.java:15: error: illegal start of type
        System.out.println("Armstrong");
              ^
Main.java:15: error: ';' expected
        System.out.println("Armstrong");
                  ^
Main.java:15: error: invalid method declaration; return type required
        System.out.println("Armstrong");
                   ^
Main.java:15: error: illegal start of type
        System.out.println("Armstrong");
                           ^
Main.java:17: error: class, interface, or enum expected
    else{
    ^
Main.java:19: error: class, interface, or enum expected
    }
    ^
46 errors
stdout
Standard output is empty