Write a program to perform division of odd number by an even number and find out the quotient and remainder
Write a program to perform division of odd number by an even number and find out the quotient and remainder
#include <iostream>
using namespace std;
int main(){
int a, b;
float c, d,e;
cout
<< "Enter The Number" << endl;
cin
>> a;
cout
<< "Enter The
Number"
<< endl;
cin
>> b;
c = a % 2;
// to find even
no;
if (c == 0){
d =
b % 2;// to find even
no;
if (d == 0){
cout
<< "you have
enter both number even" << endl;
}
else{
c
= a;
d
= b;
e
= d / c;
cout
<< "Quotient is
" << e
<< endl;
d
= b%a;
cout
<< "Reminder is
" << d
<< endl;
}
}
else{
c =
b % 2; // To check b is
even
if (c == 0){
c
= a;
d
= b;
float e = c / d;
cout
<< "Quotient is
" << e
<< endl;
d
= a%b;
cout
<< "Reminder is
" << d
<< endl;
}
else{
cout
<< "you have
enter both number odd" << endl;
}
}
system("pause");
return 0;
}
Comments
Post a Comment