Odd Even Mixed

Accept two integers A and B as the input. 
– If A and B are even then print “EVEN” as the output.
– If A and B are odd then print “ODD” as the output.
– If A is odd and B is even or if A is even and B is odd then print “MIXED” as the output.

Example Input/Output 1:
Input:
22 14

Output:
EVEN

Example Input/Output 2:
Input:
11 47

Output:
ODD

Example Input/Output 3:
Input:
34 97

Output:
MIXED

Python

num1, num2 = map(int, input().split())
if num1%2 == 0 and num2%2 == 0:
print('EVEN')
elif num1%2 != 0 and num2%2 != 0:
print('ODD')
else:
print('MIXED')

Java

import java.util.*;
public class Hello {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        if (num1 % 2 == 0 && num2 % 2 == 0) {
            System.out.print("EVEN");
        } else if (num1 % 2 != 0 && num2 % 2 != 0) {
            System.out.print("ODD");
        } else {
            System.out.print("MIXED");
        }
    }
}

C

#include <stdlib.h>
#include  <stdio.h>
int main()
{
    int num1, num2;
    scanf("%d%d", &num1, &num2);
    if(num1 % 2 == 0 && num2 % 2 == 0)
    {
        printf("EVEN");
    }
    else if(num1 % 2 != 0 && num2 % 2 != 0)
    {
        printf("ODD");
    }
    else
    {
        printf("MIXED");
    }
}

C++

#include <iostream>
using namespace std;
int main()
{
    int num1, num2;
    cin >> num1 >> num2;
    if(num1 % 2 == 0 && num2 % 2 == 0)
    {
        cout << "EVEN";
    }
    else if(num1 % 2 != 0 && num2 % 2 != 0)
    {
        cout << "ODD";
    }
    else
    {
        cout << "MIXED";
    }
    return 0;
}
Previous Article

Century or Half-Century

Next Article

Middle Three Characters

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *