4-12 判断奇偶性 (10分)
来源:互联网 发布:软件使用情况统计表 编辑:程序博客网 时间:2024/05/16 01:17
本题要求实现判断给定整数奇偶性的函数。
函数接口定义:
int even( int n );
其中n
是用户传入的整型参数。当n
为偶数时,函数返回1;n
为奇数时返回0。注意:0是偶数。
裁判测试程序样例:
#include <stdio.h>int even( int n );int main(){ int n; scanf("%d", &n); if (even(n)) printf("%d is even.\n", n); else printf("%d is odd.\n", n); return 0;}/* 你的代码将被嵌在这里 */
输入样例1:
-6
输出样例1:
-6 is even.
输入样例2:
5
输出样例2:
5 is odd.
#include <stdio.h>int even( int n );int main(){ int n; scanf("%d", &n); if (even(n)) printf("%d is even.\n", n); else printf("%d is odd.\n", n); return 0;}int even( int n ){if(n%2==0){return 1;}return 0;}
0 0
- 4-12 判断奇偶性 (10分)
- 4-12 判断奇偶性 (10分)
- 4-12 判断奇偶性 (10分)
- 4-12 判断奇偶性 (10分)
- 4-12 判断奇偶性 (10分)
- 4-7 判断奇偶性 (10分)
- 4-12 判断奇偶性
- 4-12 判断奇偶性
- 5-11 判断奇偶性 (10分)
- (函数题)4-12 判断奇偶性
- PAT基础题 4-12 判断奇偶性
- 判断奇偶性
- 判断奇偶性
- 判断奇偶性
- javascript 判断奇偶性
- 位运算判断奇偶性
- wikioi 2145 判断奇偶性
- 判断一个整数奇偶性
- lintcode:Merge Sorted Array
- override
- Android 横向二级ListView列表
- K-Means 数据聚集算法
- leetcode Remove Duplicates from Sorted List
- 4-12 判断奇偶性 (10分)
- json解析
- PostgreSQL attr correlation for values(logical order) & ctid (physcial order)
- 私有云环境openstack-juno模板共享(用于个人学习)
- python的range()函数用法
- C#using 用法
- 机器学习系列(1)_逻辑回归初步
- 华三S3100V2 、华为5700 交换机 (低端二层)配置
- Android 功能代码总结