GoogleTag

Google Search

[Programming] Question 25: Write a C Program to check if two numbers are equal without using the bitwise operator

 

#include <stdio.h>

int main() {
	int num1, num2;

	printf("Enter two numbers: ");
	scanf("%d %d", &num1, &num2);

	if (num1 - num2 == 0)
		printf("The two numbers are equal.\n");
	else
		printf("The two numbers are not equal.\n");

	return 0;
} 

Inside the main() function:

- Integer variables `num1` and `num2` are declared to store the input numbers.

- The user is prompted to enter two numbers.

- The program checks if the difference between the two numbers is equal to 0.

- If the difference is 0, it means the numbers are equal; otherwise, they are not.

- The program prints the result accordingly.



Featured Posts

SQL Interview Questions Topics

 SQL Topics to prepare for interviews,   SQL Basics: Introduction to SQL SQL Data Types DDL (Data Definition Language): C...

Popular Posts