Find Largest of three double numbers if and Logical Operators

By | March 7, 2020

Find Largest of three double numbers

#include <stdio.h> 
int main() 
    int n1, n2, n3, max; 
    printf("Enter first number=");
	printf("Enter second number=");
	printf("Enter third number=");
	max = (n1 > n2) ? (n1 > n3 ? n1 : n3) : (n2 > n3 ? n2 : n3); 
    printf("Largest number among %d, %d and %d is %d.",n1, n2, n3, max); 
    return 0; 


Please Enter three different numbers: 20.50 40.23 90.7
90.70 is the largest number.

Leave a Reply

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