It is working but i am not able to scan two inputs at the same time

import java.util.Scanner;

public class Online {

public static void main(String[] args) {
	// TODO Auto-generated method stub
	int j;
	int ans =0;
	int r;
	System.out.println("enter the total no");

Scanner scn = new Scanner(System.in);
int N = scn.nextInt();
for(j=1;j<=N;j++) {
System.out.println(“enter the number”+j);
int i = scn.nextInt();
while(i!=0) {
r=i%10;
ans= ans +r;
i=i/10;}
if(ans % 2 != 0 && ans % 3==0) {
System.out.println(“Yes”);}
else if (ans % 4 == 0) {
System.out.println(“Yes”);}
else {
System.out.println(“No”);}
}

}

}

hey @rishabh.chhabra10
input formate is fine:
just remove this line System.out.println(“enter the number”+j); and this System.out.println(“enter the total no”);:
logic is wrong
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
int j;
int ans = 0;
int r;
//System.out.println(“enter the total no”);
Scanner scn = new Scanner(System.in);
int N = scn.nextInt();
for (j = 1; j <= N; j++) {
// System.out.println(“enter the number” + j);
int i = scn.nextInt();
while (i != 0) {
r = i % 10;
ans = ans + r;
i = i / 10;
}
if (ans % 2 != 0 && ans % 3 == 0) {
System.out.println(“Yes”);
} else if (ans % 4 == 0) {
System.out.println(“Yes”);
} else {
System.out.println(“No”);
}
}
}
}

what should be the code and in which part of logic i am making mistakes ?

r = i % 10;
ans = ans + r;
i = i / 10;
// * Declare two variables to store the sum of even numbers and odd numbers.

  • Extract digit one by one ( by % 10).
    1. Check if the number is even or odd.

    2. If even add the number in the variable storing even sum.
      Othewise add it in the variable storing odd sum.

i am not able to understand how to scan two numbers or integers at the same time

Not scan two numbers or integers at the same time.
let N =2;
when j=1
Scan 1 integers
The loop will work.
j=2
Scan 1 integers
( ek baar loop chelga to ek Integer input le rahe hain)