|
Write a program which input three numbers
and display the largest number using ternary operator.
#include <iostream.h>
#include <conio.h>
int main() { int a,b,c,greatest; cout<<"Enter three numbers : "; cin>>a>>b>>c; greatest=(a>b&&a>c)?a:(b>c)?b : c; cout<<"Greatest number is "<<greatest;
getch(); return 0; } |
No comments:
Post a Comment