C Program Find Larger Value between Two variables

By | March 15, 2020

C Program Find Larger Value between Two variables

/* Find larger value between two variable
   www.easycodebook.com
 */

#include<stdio.h>
int main()
{
    int n1,n2;
    printf("Enter value of N1: ");
    scanf("%d",&n1);
    printf("Enter value of N2: ");
    scanf("%d",&n2);   
   
    if(n1>n2)
        printf("N1 is larger");
    else if(n2>n1)
        printf("N2 is larger");
    else
        printf("Both numbers are equal");
    return 0;
}

Output 1:

Enter value of N1: 10
Enter value of N2: 125
N2 is larger

Output 2:

Enter value of N1: 56
Enter value of N2: 56
Both numbers are equal

Output 3:

Enter value of N1: 45
Enter value of N2: 1
N1 is larger

Loading

Leave a Reply

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