FIND LARGEST NUMBER B/W THREE NUMBERS USING CONDITIONAL OPERATOR

/*PROGRAM TO FIND LARGEST NUMBER B/W THREE NUMBERS USING CONDITIONAL OPERATOR*/

#include<conio.h>

#include<iostream.h>

class largest

{

int a,b,c;

public:

void input();

void output();

};

void largest::input()

{

cout<<“Enter any three numbers: “;

cin>>a>>b>>c;

}

void largest::output()

{

(a>b && a>c)?cout<<a<<” is greatest”:((b>c && b>a)?cout<<b<<” is greatest”:cout<<c<<” is greatest”);

}

void main()

{

largest l1;

clrscr();

l1.input();

l1.output();

getch();

}

Leave a Reply

Your email address will not be published. Required fields are marked *