Showing posts with label Write a C Program to find the Largest Number (integer) among Three Numbers (integers) using IF and Logical && operator.. Show all posts
Showing posts with label Write a C Program to find the Largest Number (integer) among Three Numbers (integers) using IF and Logical && operator.. Show all posts
Sunday, August 6, 2023

Write a C Program to find the Largest Number (integer) among Three Numbers (integers) using IF and Logical && operator.


 

Write a C Program to find the Largest Number (integer)  among Three Numbers (integers) using IF and Logical && operator.


Program:-

#include <stdio.h>

int main()

{

    int n1, n2, n3;


    scanf("%d %d %d", &n1, &n2, &n3); /*Three numbers are accepted from the test case */

if( n1>=n2 && n1>=n3 )
        printf("%d is the largest number.", n1);

    if( n2>=n1 && n2>=n3 )
        printf("%d is the largest number.", n2);

    if( n3>=n1 && n3>=n2 )
        printf("%d is the largest number.", n3);
}


InputOutput
Test Case 1
45 34 67
67 is the largest number.
Test Case 2
80 -5 3
80 is the largest number.