1 solutions

  • 0
    @ 2025-3-3 16:28:36

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
       int x;
       cin>>x;
       if(x % 2 == 0 || x % 3 == 0){
       	  cout<<"Y"<<endl;
       }else{
       	  cout<<"N"<<endl;
       }
    }
    
    

    Java :

    import java.util.Scanner;
    public class Main
    {   
    	public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
    		if(a%2==0 || a%3==0) {
    			System.out.println("Y");
    		}else{
    			System.out.println("N");
    		}
    		
    		
        }
    }
    

    Python :

    n = int(input())
    if n % 2 == 0 or n % 3 == 0:
        print('Y')
    else:
        print('N')
    
    
    • 1

    Information

    ID
    10239
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By