Find largest value among three variable – conditional operator

Find largest value among three variable - conditional operator

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn C programming concepts. You can learn C language at your own speed and time. One can learn concepts of C language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Find largest value among three variable - conditional operator
Find largest value among three variable – conditional operator

Write a C program to Find largest value among three variable – conditional operator

PROGRAM: Find largest value among three variable – conditional operator

/*    Find largest value among three variable using conditional operator    */

#include<stdio.h>
int main()
{
 int a,b,c,d;

 printf(“Type values of A,B and C : “);
 scanf(“%d %d %d”,&a,&b,&c);
 d=(a>=b?a>=c?a:c:b>=c?b:c);
 printf(“Greatest value : %d”,d);
 return 0;
}

Leave a Reply

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