Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \\Ternary Operator
- #include <stdio.h>
- int main()
- {
- float n1,n2,n3,large;
- printf("Enter 3 numbers.\n");
- scanf("%f%f%f",&n1,&n2,&n3);
- large = n1 > n2 ? (n1 > n3 ? n1 : n3) : (n2 > n3 ? n2 : n3);
- printf("The largest number is %.2f",large);
- return 0;
- }
- \\Output
- \\Enter 3 numbers.
- \\3.14
- \\3.22
- \\6.76
- \\The largest number is 6.76
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement