answersLogoWhite

0


Best Answer

// assume you want the find the largest of ints a,b,c:

int max = (a>b&&a>c?a:b>c?b:c);

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

largest = first > second ? (first > third ? first : third): (second > third ? second : third);

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

In C or C++:

int max( int x, int y ) { return( x>y?x:y ); }

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

printf ("Biggest: %d\n", N>M ? N : M);

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a program to find out largest number between two numbers using ternary operators?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a c plus plus program to find the largest among three numbers using ternary operators?

R = (A > B && A > C) ? A : (B > C) ? B : C; // parentheses not necessary - for clarity only


How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


What do you mean by operators and operands?

operands are the objects or variable that we create in our program. operators fuse with the operands to build a mathematical statement in the program.


What are the different Turbo C operators?

TurboC is a program, the language is C Some of the operators are: . -> * [] () , ?: = == < <= > >= != + += ++ - -= -- % %= / /= << <<= >> >>= ! ~ ^ & &= && | |=


How do you write a VBnet program to find the prime numbers between 100 to 200?

VBnet program to find the prime numbers between 100 to 200?


How a program in c that will add 2 numbers without using any operator?

Not possible. Let's not forget than in C the followings are all operators:+, -+=, -=++, --=&, *, []function-call


Write a 'c' program to fine a largest of three numbers?

largest of a, b, c :a > b ? a > c ? a : c : b > c ? b : c


C program to fine the largest of 10 given number?

first sort the ten numbers in descending order and print the first number. That will be the largest no


Q2 Write a program to print even numbers between 10 and 50?

You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.


How to write a program that ask user to enter numbers until user enter- 0 then find the biggest of entered numbers in C programming using while or do while?

int i, largest=0;do { scanf ("Enter a number (0 to exit): %d", i); if (i>largest) largest=i; } while (i!=0); printf ("Largest number is: %d\n", largest);


Write a C plus plus program and flow chart to find the largest of the 3 numbers?

To find the largest of three numbers, first find the largest of two numbers: int max (int x, int y) { return x<y?y:x; } Now you can use this one function to find the largest of three numbers: int max (int x, int y, int z) { return max (max (x, y), z); }


Write a shell program to find largest of three numbers?

echo Enter 3 numbers with spaces in between read a b c l=$a if [ $b -gt $l ] then l=$b fi if [ $c -gt $l ] then l=$c fi echo Lagest of $a $b $c is $l