Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int num, num1;
  6. cout << "enter a number:" << endl;
  7. cin >> num;
  8. if (num < 100 && num>9) {//if the number between 9-100
  9. num1 = num % 10;
  10.  
  11. if (num1 % 2 != 0 && num / 10 % 2 != 0) {// checks if the all number is'nt even number.
  12. cout << "odd digits only" << endl << num1 + (num / 10) << endl;
  13.  
  14.  
  15. }
  16.  
  17. 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.
  18. {
  19. cout << "mixed number" << endl;
  20. }
  21. else
  22. {
  23. cout << "even digits only" << endl << num1 * (num / 10) << endl;
  24. }
  25.  
  26.  
  27.  
  28.  
  29. }
  30.  
  31. else
  32. {
  33.  
  34. cout << "error" << endl;
  35. }
  36.  
  37. // system("pause");
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement