Can u find maximum of 3 values by return function?

Return Function

HOME Forums Forum Return Function

This topic contains 1 reply, has 1 voice, and was last updated by  Tang Seakmeng 1 year, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #911 Reply

    RaksmeyChea

    Can u find maximum of 3 values by return function?

    #912 Reply

    Tang Seakmeng
    #include<iostream.h>
    #include<conio.h>
    int maximum(int x, int y, int z)
    {
    	if(x>y&&x>z)
       return x;
       else if(y>z)
       return y;
       else
       return z;
    }
    void main()
    {
    	int a, b, c;
       cout<<"Enter a first number= ";
       cin>>a;
       cout<<"Enter a second number= ";
       cin>>b;
       cout<<"Enter a third number= ";
       cin>>c;
       cout<<"Maximum is = "<<maximum(a, b, c);
       getch();
    }
    
    
    
    		
    	
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Return Function
Your information: