Question Bank (5 marks) · Q12
Q.Write a C program to accept two numbers and check whether they are equal or unequal.
Karnataka PUCTextbookLong· 5mImportance★★★★★est
41% · 63/154 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →[!TLDR]
Read two numbers and test (a == b) in an if...else to report them as equal or unequal.
Two numbers are compared with the equality relational operator ==, which is true only when the values are identical. The result decides which message is printed.
#include <stdio.h>
int main()
{
int a, b;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
if (a == b)
printf("The two numbers are equal\n");
else
printf("The two numbers are unequal\n");
return 0;
}
``` …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.