Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. // Problem 3.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <string>
  7.  
  8. using namespace std;
  9.  
  10. bool check(string a)
  11. {
  12. for (int i = 0; i <= a.length(); i++)
  13. {
  14. if (a[i] % 2 = 0)
  15. {
  16. return true;
  17. }
  18. else
  19. {
  20. return false;
  21. }
  22. }
  23.  
  24. }
  25.  
  26. int main()
  27. {
  28. cout << "Enter a number:" << endl;
  29. string a;
  30. while (cin >> a)
  31. {
  32. if (a = 0 || a < 0)
  33. {
  34. cout << "N/A" << endl;
  35. }
  36. else if (check(a))
  37. {
  38. cout << "YES" << endl;
  39. }
  40. else
  41. {
  42. cout << "NO" << endl;
  43. }
  44. }
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement