Tuesday 30 December 2014

Write a C++ to find greatest of three numbers.


#include<iostream>
using namespace std;
int sum(int x,int y,int z)
{
if(x>y)
{ if(y>z)
{
return x;
}}
if(y>z)
{
return y;
}

else{ return z;
}
}
int main()
{ int a=0,b=0,c=0;
cout<<"enter first no";
cin>>a;
cout<<"enter second no";
cin>>b;
cout<<"enter third no";
cin>>c;
int d= sum(a,b,c);
cout<<"greatest is "< }

No comments:

Post a Comment

SAY HELLO!!