Von neuman loves binary

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0) {
int n = sc.nextInt();
int decimal = 0;
int p=0;
while(n!=0) {
decimal+=((n%10)*Math.pow(2,p));
n=n/10;
}
System.out.println(decimal);
t–;
}
}
}

sir can u tell  me why it is not able to solve testcases

hey @karthik1989photos after this Steps decimal+=((n%10)Math.pow(2,p));
just increment value of p
import java.util.
;

public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t > 0) {
int n = sc.nextInt();
int decimal = 0;
int p = 0;
while (n != 0) {
decimal += ((n % 10) * Math.pow(2, p));
n = n / 10;
p++;
}
System.out.println(decimal);
t–;
}
}
}

import java.util.*;

public class Main {

public static void main(String args[]) {

Scanner sc = new Scanner(System.in);

int t = sc.nextInt();

while(t>0) {

int n = sc.nextInt();

int decimal = 0;

int p=0;

while(n!=0) {

decimal+=((n%10)*Math.pow(2,p));

n=n/10;

p++

}

System.out.println(decimal);

t–;

}

}

}
again testcases are not running,plz helpme to solve


you can see this

source.cpp:2:1: error: ‘import’ does not name a type
2 | import java.util.*;
| ^~~~~~
source.cpp:4:1: error: expected unqualified-id before ‘public’
4 | public class Main {
| ^~~~~~
on compiling in that site it showing these errord

bro submit your code in Java language

i m submitting in java only

code is fine https://ide.codingblocks.com/s/257875?_ga=2.167428606.1303839061.1592023748-527456201.1584272906

1 712 356 993
this my teamviewer id

source.cpp:2:1: error: ‘import’ does not name a type
2 | import java.util.*;
| ^~~~~~
source.cpp:4:1: error: expected unqualified-id before ‘public’
4 | public class Main {
| ^~~~~~
on compiling in that site it showing these errord
This error indicates. You are choosing c ++ language