Skip to content
Question Bank (3 marks) · Q8

Q.Write a C program to check whether given two integers are equal.

Karnataka PUCTextbookLong· 3mImportance★★★★★est
27% · 42/154 Questions
🔒 Locked · start free trial →

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 integers and compare them with the == operator inside an if...else to report whether they are equal.

The equality of two integers is tested with the relational operator ==, which gives 1 (true) when the two values are identical. The program reads the two numbers, applies the test in an if...else construct, and prints the appropriate message.

#include <stdio.h>
int main()
{
    int a, b;
    printf("Enter two integers: ");
    scanf("%d %d", &a, &b);
    if (a == b)
        printf("The two integers are equal\n");
    else …

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.