Two Numbers Equal

The program must accept two numbers and print yes if they are equal. Else the program must print no as the output.

Example Input/Output 1:
Input:
40 40

Output:
yes

Example Input/Output 2:
Input:
50 90

Output:
no

Python

X, Y = map(int, input().split())
if X == Y:
    print('yes')
else:
    print('no') 

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();
        System.out.print(num1 == num2 ? "yes" : "no");
    }
}

C

#include <stdlib.h>
#include  <stdio.h>
int main()
{
    int X, Y;
    scanf("%d %d", &X, &Y);
    printf(X == Y ? "yes" : "no");
}

C++

#include <iostream>
using namespace std;
int main()
{
    int X, Y;
    cin >> X >> Y;
    cout << (X == Y ? "yes" : "no");
    return 0;
}

Leave a Reply

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

More posts. You may also be interested in.