A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

C program to check whether two numbers are equal or not
Q:

C program to check whether two numbers are equal or not

belongs to collection: C programs - Basic C Programs

0

Write C program accepts two integers and check if they are equal. Equality operator (==) is used to compare the given two numbers.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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”.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C program to perform addition, subtraction, multip... >>
<< C program to convert an binary number to octal...