Check Two Numbers Equal or Not C Program

By | June 18, 2019

This is a C language program. It inputs two numbers and check whether both entered numbers are equal or not. It uses simple if statements to perform the required task.

 

/*
Write a C Program 
to input two numbers and check
both numbers are equal or not equal
using simple if statement 
*/
#include<stdio.h>

int main()
{
   int num1, num2;
   printf("Enter First Number=");
   scanf("%d", &num1);
   printf("Enter 2nd Number=");
   scanf("%d", &num2);
   if(num1 == num2)
     printf("First Number %d is equal to Second Number %d ", num1,num2);
   if(num1 != num2)
     printf("First Number %d is not equal to Second Number %d ", num1,num2);
   
   return 0;
}

The following is an image showing output of the sample run of this program to check whether both numbers are equal or not:

Check Two Numbers Equal or Not C Program

Check Two Numbers Equal or Not C Program

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *