C program to check whether two numbers are equal or not - Source code
#include <stdio.h>
void main()
{
int num1, num2;
printf("Enter the two integer numbers\n");
scanf("%d %d", &num1, &num2);
if (num1 == num2)
printf("The two numbers are equal\n");
else
printf("The two numbers are not equal\n");
}
Program Output
Case 1:
Enter the two integer numbers
76464
67890
The two numbers are not equal
Case 2:
Enter the two integer numbers
8521
8521
The two numbers are equal
Program Explanation
1. Take the two integers as input and store it in the variables num1 and num2 respectively.
2. Compare them using the equal to (==) operator.
3. If they are equal, then print the output as “The two numbers are equal”.
4. Otherwise print it as “The two numbers are not equal”.
C program to check whether two numbers are equal or not - Source code
Program Output
Program Explanation
1. Take the two integers as input and store it in the variables num1 and num2 respectively.
2. Compare them using the equal to (==) operator.
3. If they are equal, then print the output as “The two numbers are equal”.
4. Otherwise print it as “The two numbers are not equal”.
need an explanation for this answer? contact us directly to get an explanation for this answer