C++ program to find largest of three number using function

#include<iostream>
using namespace std;
int largest (int num1,int num2,int num3);
int main()
{
int num1,num2,num3,large;
cout<<“Enter three numbers one by one n”;
cin>>num1>>num2>>num3;
large=largest(num1,num2,num3);
cout<<“The largest number in num1,num2,num3 is t”<<large;
}
int largest(int num1,int num2,int num3)
{

if(num1>num2 && num1>num3)

return num1;

if(num2>num1 && num2>num3)

return num2;

else

return num3;
}
OUTPUT:
Enter three numbers one by one
9
6
7
The largest number in num1,num2,num3 is 9

Leave a Comment

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

To Resolve this issue at just 5$ from ServerExpert

https://serverexpert.io/

For Hosting please visit Hostingwebsite.io

You have Successfully Subscribed!

Open chat