4/01/2009

C++ Program To Find Minimum And Maximum Of Two Numbers Using Function


/* C++ Program To Find Minimum And Maximum Of Two Numbers Using Function */

#include <iostream>

using namespace std;

void min(int,int);
void max(int,int);
void max(int a,int b)
{
    float sum=0;
    if(a>b)
    {
        cout<<"Max of numbers is A:"<<a<<endl;
        cout<<"Min of numbers is B:"<<b<<endl;
    }
    else
        min(a,b);

}
void min(int a,int b)
{
        cout<<"Max of numbers is B:"<<b<<endl;
        cout<<"Min of numbers is A:"<<a<<endl;
}
int main()
{
    int a, b, c;
      cout<<"Enter The Values For A And B:"<<endl;
        cin>>a>>b;
    max(a,b);

    return 0;
 }
Out Put:
Enter The Values For A And B:
34
65
Max of numbers is B:65
Min of numbers is A:34

No comments:

Post a Comment