C Program to Accept two Integers and Check if they are Equal

C Programming Computer Science

In this C Program we are going to accept two integers and check whether they are equal or not.

  • Source Code

/*
 * C program to accept two integers and check if they are equal
 */
#include <stdio.h>
void main()
{
    int m, n;
 
    printf("Enter the values for m and n\n");
    scanf("%d %d", &m, &n);
    if (m == n)
        printf("m and n are equal\n");
    else
        printf("m and n are not equal\n");
}

 

  • Runtime
Case:1
Enter the values for m and n
6 6
m and n are equal
 
Case:2
Enter the values for m and n
3 5
m and n are not equal

Also Read: 

C PROGRAM TO FIND THE NUMBER OF INTEGERS DIVISIBLE BY 3

C PROGRAM TO CHECK IF A GIVEN INTEGER IS POSITIVE OR NEGATIVE

C PROGRAM TO CALCULATE THE SUM OF ODD AND EVEN NUMBERS

C PROGRAM TO CHECK IF A GIVEN INTEGER IS ODD OR EVEN

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.