C++ Program to find greatest between three numbers using Functions

Find greatest between three numbers using Functions

This program illustrate the concept to find greatest between three numbers using Functions.

Program

#include<iostream.h>
#include<conio.h>
void scan(int,int,int);
void main()
{
clrscr();
int a,b,c;
cout<<"Enter value of x:- ";
cin>>a;
cout<<"Enter value of y:- ";
cin>>b;
cout<<"Enter value of z:- ";
cin>>c;
scan(a,b,c);
getch();
}
void scan(int x,int y,int z)
{
if(x>y)
 {
  if(x>z)
   {
	cout<<"x is greater";
   }
   else
    {
    cout<<"z is greater";
    }
 }
else
{
 if(y>z)
  {
   cout<<"y is greater";
  }
 else
 {
  cout<<"z is greater";
 }
}
}

OUTPUT:-

find Greatest between three numbers using Functions


Comment below if you are facing any problem and subscribe to our newsletter for latest update.


Also read

C++ program to find area and perimeter of rectangle using Class
C++ Program to add two numbers by defining function Outside the class
C++ Simple Program of Static Data Member
C++ program of Static Member Function
C++ program to print 3×3 matrix using class


Summary
C++ Program to find greatest between three numbers using Functions
Article Name
C++ Program to find greatest between three numbers using Functions
Description
Greatest between three numbers using call by value
Author
Publisher Name
Scanfcode
Publisher Logo

Leave a Reply

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