Skip to content

C++ Program to Find Smallest Number using Call by Value

C++ Program to Find Smallest Number using Call by Value

Code:

/*C++ Program to Find Smallest Number using Call by Value*/
#include<iostream.h>
#include<conio.h>
int compare(int a,int b)
{
return((a<b)?a:b);
}
void main()
{
clrscr();
cout<< “smallest num is:” << compare(1,10) << endl;
cout<< “smallest num is:” << compare(20,10) << endl;
cout<< “smallest num is:” << compare(5,7) << endl;
getch();
}


Sample Output:


Comment bellow for your Query and Feedback

Leave a Reply

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

error: Content is protected !!