Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Problem 3.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- using namespace std;
- bool check(string a)
- {
- for (int i = 0; i <= a.length(); i++)
- {
- if (a[i] % 2 = 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
- int main()
- {
- cout << "Enter a number:" << endl;
- string a;
- while (cin >> a)
- {
- if (a = 0 || a < 0)
- {
- cout << "N/A" << endl;
- }
- else if (check(a))
- {
- cout << "YES" << endl;
- }
- else
- {
- cout << "NO" << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement