15.9.15

conditional operator in c++

/* Use of Conditional Operator */

#include<iostream>
using namespace std;
int Multiple(int a,int b);
int main()
{
int a,b;
cout<<"Enter two integer:"<<endl;
cin>>a>>b;
Multiple(a,b);
}
int Multiple(int a,int b)
{
if(a>b)
{
if(a%b==0)
cout<<"Multiple"<<endl;
else
cout<<"Not Multiple"<<endl;
}
else if(a<b)
{
if(b%a==0)
cout<<"Multiple"<<endl;
else
cout<<"Not Multiple"<<endl;
}
return 0;
}

No comments:

Post a Comment

Comment Here