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

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

Q:-Write a C program to accept two integers and check whether they are equal or not
In this C program we are accepting two integers using scanf and comparing both the input integer value and comparing them if they are equal or not using if-else. If the integer value are equal we will receive output Number1 and Number2 are equal. Otherwise the output will say Number1 and Number2 are not equal

#include<stdio.h>
#include<conio.h>

void main() 
{
int num1, num2;
 clrscr();
    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");
getch();
 }

Output

1. Take the two integers as input and store it in the variables num1 and num2 respectively.

2. Using if,else statements check if m is equal to n.

3. If they are equal, then print the output as “num1 and num2 are equal”.

4. Otherwise print it as “num1 and num2 are not equal”

TOP