Simple Example Program for Function Find Smallest Number In C++

Join Our Official AiJobsAdda Telegram Channel
#include<iostream>
#include<conio.h>
using namespace std;
// Simple Function
int compare( int a, int b )
{
return (a+4 < b)? a : b;
}
int main()
{
cout<<”\nSmallest Number :”<<compare(1,10);
cout<<”\nSmallest Number :”<<compare(31,10);
cout<<”\nSmallest Number :”<<compare(11,8);
getch();
return 0;
}

 

Output :
Smallest Number :1
Smallest Number :10
Smallest Number :8