C Program to find Greatest of Two Numbers

C Program to find Greatest of Two Numbers

How to find the Greatest Number between two given Integer Number in C? We can easily find the Greatest Value by using "if-else" Statement in C.

Finding Greatest Number in C :



#include<stdio.h>  
   
int main() {  
    int a, b;  
    printf("Please Enter Two different values\n");  
    scanf("%d %d", &a, &b);  
    
    if(a > b) 
    {
        printf("%d is Largest\n", a);          
    } 
    else if (b > a)
    { 
        printf("%d is Largest\n", b);  
    } 
    else 
    {
	printf("Both are Equal\n");
    }
   
    return 0;  
}


Output :