Computer Scientists are Pretty Pessimistic

Monday 5 October 2015

Using ternary operator (? :) write down an expression to find largest of three numbers.

CODE ::

#include <stdio.h>
int main ()
{
    int a=15,b=20,c=10,big;

    big = (a>b) ? a : b;

    big = (big>c) ? big : c;

    printf("%d\n",big);

    return 0;
}


No comments:

Post a Comment