A program to accept two integers and check whether they are equal or not.

Here, we have a basic program example to check if two numbers are equal or not using different languages. This program is created in c language, c++, Java, and Python.

Program to check if two numbers are equal in C language

#include <stdio.h>
void main()
{
    int num1, num2;

    printf("Input the values for Number1 : ");
    scanf("%d", &num1);
    printf("Input the values for Number2 : ");
    scanf("%d", &num2);
    if (num1 == num2)
        printf("Number1 and Number2 are equal\n");
    else
        printf("Number1 and Number2 are not equal\n");
}

Program to check if two numbers are equal in C++ language

#include<iostream>
using namespace std;
int main(){
int num1, num2;

    cout<<"Input the values for Number1 : ";
    cin>>num1;
    cout<<"Input the values for Number2 : ";
    cin>>num2;
    if (num1 == num2)
        cout<<"Number1 and Number2 are equal\n";
    else
        cout<<"Number1 and Number2 are not equal\n";
}

Program to check if two numbers are equal in Python language

num1 = int(input("Input the values for Number1 : "))
num2 = int(input("Input the values for Number2 : "))
if num1 == num2 :
    print("Number1 and Number2 are equal\n")
else:
    print("Number1 and Number2 are not equal\n")

Program to check if two numbers are equal in Java language

import java.util.*;
class equality
 {
   public static void main(String[] args)
    {
      int num1, num2;
  
      Scanner s=new Scanner(System.in);
      System.out.println("Input the values for Number1 :");
      num1 = s.nextInt();
      System.out.println("Input the values for Number2 : ");
      num2 = s.nextInt();
     if(num1==num2){
       System.out.println("Number1 and Number2 are equal");
          }
     else {
      System.out.println("Number1 and Number2 are not equal");      
          }
}
}