04:奇偶ASCII值判断
OpenJudge-1.4编程基础之逻辑表达式与条件分支-04:奇偶ASCII值判断
总Time Limit: 1000ms Memory Limit: 65536kB
Description
任意输入一个字符,判断其ASCII是否是奇数,若是,输出YES,否则,输出NO
例如,字符A的ASCII值是65,则输出YES,若输入字符B(ASCII值是66),则输出NO
Input
输入一个字符
Output
如果其ASCII值为奇数,则输出YES,否则,输出NO
Sample Input
A
Sample Output
YES
Source
元培-From Whf
C++ Code
#include <iostream>
#include <cstdio>
#include<cmath>
using namespace std;
int main()
{
char a;
a=getchar();
if(a%2==0)
cout<<"NO";
else
cout<<"YES";
return 0;
}