Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int num, num1;
- cout << "enter a number:" << endl;
- cin >> num;
- if (num < 100 && num>9) {//if the number between 9-100
- num1 = num % 10;
- if (num1 % 2 != 0 && num / 10 % 2 != 0) {// checks if the all number is'nt even number.
- cout << "odd digits only" << endl << num1 + (num / 10) << endl;
- }
- else if ((num1 % 2 != 0 && num / 10 % 2==0) || (num1 % 2 == 0 && num / 10 % 2 != 0))//Checks whether one digit is even and one odd.
- {
- cout << "mixed number" << endl;
- }
- else
- {
- cout << "even digits only" << endl << num1 * (num / 10) << endl;
- }
- }
- else
- {
- cout << "error" << endl;
- }
- // system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement