Aug 28, 2015

Program in C++ to find largest & smallest of four no using inline function

/*  Program to find largest & smallest of four no using inline function */
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
inline int largest(int x,int y)
{
return(x>y?x:y);
}
void main()
{
clrscr();
int a,b,c,d;
cout<<"Enter any 4 num : ";
cin>>a>>b>>c>>d;
int lar=largest(largest(a,b),largest(c,d));
cout<<"\n The largest of the given four nos is  "<<lar;
int sml=smallest(smallest(a,b),smallest(c,d));
cout<<"\n the smallest of the given four no is "<<sml;
getch();
}

No comments:

Post a Comment