Sr my code is correct still this editor doesn't accept my code & i didn't get any point

WTH
sr my code is correct still this editor doesn’t accept my code & i didn’t get any point
although i dont know that input has to be given in below section before it runs

@Harsh_Sonwani First of all You have to just print yes or no, secondly your logic is wrong read the question carefully.

Here is the correct approach. Read the statements carefully

  • Take input of the Number.
  • 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.

  1. Othewise add it in the variable storing odd sum.
  • After the loop, Check if the even sum is divisible by 4.
    1. If True, print Yes.

    2. otherwise print No.

  • Check if the odd sum is divisible by 3.
    1. If True, print Yes.

    2. otherwise print No.

If you have any doubt lemme know, else resolve the doubt.

import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scn = new Scanner(System.in); int N1 = scn.nextInt(); int i = 1; while(i<=N1) { int N2 = scn.nextInt(); int s=0; while (N2 != 0) { int m = N2 % 10; s = s + m; N2 = N2 / 10; } if(s%2==0 && s%4==0 || s%2==1 && s%3==0) System.out.println(“yes”); else System.out.println(“No”); i+=1; } } }

check my code what is the problem rises in it

@Harsh_Sonwani First properly format your code and then submit it!

num = []
n = int(input())
for i in range(0,n):
    num.append(input())

for i in range(0, n):
    even = 0
    odd = 0
    a = [int(c) for c in num[i]]
    for i in range(len(a)):
        if a[i] % 2 == 0:
            even = even + a[i]
            print(even)
        else:
            odd = odd + a[i]
    if even % 4 == 0 or odd % 3 == 0:
        print("Yes")
    elif even % 4 != 0 and odd % 3 != 0:
        print("No")

I have done this problem in Python 3

public class DelhiOddEven { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int i = 1; while (i <= n) { int a = scn.nextInt(); int q = 0; int s = 0; while (a != 0) { int m = a % 10; s = s + m; q += 1; a = a / 10; } // System.out.println(s); if (s % 2 == 0 && s % 4 == 0 || s % 2 == 1 && s % 3 == 0) System.out.println(“Yes”); else System.out.println(“No”); i += 1; } } }

@Harsh_Sonwani Bro have you read the question carefully or the explanation i gave above?

" the sum of digits which are even is divisible by 4 or sum of digits which are odd in that number is divisible by 3"

You have to check if the digit is even or digit is odd maintain two sums i.e evendigitsum and odddigitsum.

Here is the algorithm:-

  • Algorithm
  • Take input of the Number.
  • 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.

  1. Othewise add it in the variable storing odd sum.
  • After the loop, Check if the even sum is divisible by 4.
    1. If True, print Yes.

    2. otherwise print No.

  • Check if the odd sum is divisible by 3.
    1. If True, print Yes.

    2. otherwise print No.

If you are passing sample that doesn’t means your logic is right.

So bro correct it. Above also I gave you correct algorithm but you didn’t corrected, I don’t know why? If you want code for reference then tell me.

If your doubt is cleared mark the doubt resolved.

srry for asking again
plz give me the code i don’t know but i’m really so confused

@Harsh_Sonwani Bro pfa attached the code below:-
And bro code it once after seeing it, so that you can learn.
And resolve the doubt!