Search C Program | nimishsoft@gmail.com

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;
}

Related Posts
Largest value among three variables
http://cbasicprogram.blogspot.in/2012/02/largest-value-among-three-variables.html

Largest among 3 variables using nested if
http://cbasicprogram.blogspot.in/2012/02/largest-among-3-variables-using-nested.html

4 comments:

  1. yahan aapko iska output bhi dena chahiye aur flow chart aur theory

    ReplyDelete
  2. Nice Program, to the point.
    though i had to search for theory. I read the thoery from here first, then I understood better.
    C language operator.

    ReplyDelete
  3. Nice article for beginners keep it up... Patterns in C

    ReplyDelete