Posted by MindBreaker at 8:35 AM
Read our previous post
Object
1-
Find
Greater of two number using function
Source code
#include <iostream>
using namespace std;
int
number(int,int);
int
number(int x,int
y)
{
if
(x>y)
{
cout<<"1st number is greater than 2nd number"<<x<<endl;
}
else if(y>x)
{
cout<<"2nd number is greater than 1st number"<<y<<endl;
}
return
(x,y);
}
void
main(void )
{int x,y,answer;
cout<<"Enter a 1st number"<<endl;
cin>>x;
cout<<"Enter second number"<<endl;
cin>>y;
answer=number(x,y);
cout<<answer;}
Output
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.