Pages

Friday 18 March 2011

PROGRAM TO FIND MINIMUM OF FOUR NUMBER USING FUNCTION

DESCRIPTION-:The program finds the greater between four number using the function.In program we pass the four parameters in the function call but in pair(means in function call we have two pair).This program firstly calculate the minimum number in first pair and then calculate the minimum number in second pair.After this program calculate the minimum number between the output of first and second pair.
FOR EXAMPLE-:If we enter four number as-------

                                     23    34    21    39
Then it generate output as----------
firstly it calculate minimum number between  23    and    34   =23
then it calculate minimum number between    21    and    39   =21
at last it calculate the minimum number between  21    and    23    =21

PROGRAM-:
#include<iostream.h>
#include<conio.h>
int min(int,int);
void main()
{
clrscr();
int a,b,c,d;
cout<<"enter four integers";
cin>>a>>b>>c>>d;
cout<<"minimun no. ="<<min(min(a,b),min(c,d));
getch();
}
int min(int x,int y)
{
return((x<y)?x:y);
}

0 comments:

Post a Comment

 
Copyright (c) 2010 Concepts Of C++. Design by WPThemes Expert

Blogger Templates and RegistryBooster.