Write a C++ program to find the largest of three numbers using inline function.

#include<iostream.h>
#include<conio.h>
inline int largest(int &a,int &b,int &c)
{
int big=0;
if(a>b)
big=a;
else
big=b;
if(c>big)
big=c;
return big;
}
int main()
{
int a,b,c;
clrscr();
cout<<"Enter Three Numbers To Find The Largest "<<endl;
cout<<"a = ";
cin>>a;
cout<<"\nb = ";
cin>>b;
cout<<"\nc = ";
cin>>c;
int large=largest(a,b,c);
cout<<"\n Largest of "<<a<<","<<b<<" and "<<c<<" is "<<large;

getch();
return(0);
}

Enter Three Numbers To Find The Largest
a = 24
b = 45
c = 23
Largest of 24,45 and 23 is 45


Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: