Home / Programs / Write a program in C to check whether the two given numbers are equal but using = instead of ==
Programming Example

Write a program in C to check whether the two given numbers are equal but using = instead of ==

👁 5,589 Views
💻 Practical Program
📘 Step by Step Learning
Write a program in C to check whether the two given numbers are equal but using = instead of ==

Program Code

#include <stdio.h>
int main()
{
	int a=2, b=3;
	if(a = b)
		printf("EQUAL");
	else
		printf("UNEQUAL");
		
	getch();	
	return 0;
}

Output

EQUAL

Explanation

if(a = b) In this statement b is assign in b
fro that the output is EQUAL

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.