zzuli OJ 1046: 奇数的乘积
2015-08-28 16:16
162 查看
Description
给你n个整数,求他们中所有奇数的乘积。
Input
第一个数为n,表示本组数据一共有n个,接着是n个整数,你可以假设每组数据必定至少存在一个奇数。
Output
输出n个数中的所有奇数的乘积,占一行。
Sample Input
5 2 5 4 6 7Sample Output
35HINT
...Source
#include<stdio.h> int main() { int i, n; int d, product; scanf("%d", &n); product = 1; for(i = 1; i <= n; i++) { scanf("%d", &d); if(d % 2 != 0) product *= d; } printf("%d\n", product); return 0; }
相关文章推荐
- Linux中表示“时间”的结构体和相关函数
- 使用批次优化渲染
- LAB颜色空间各通道的取值范围
- cocos2dx导出的json转c++代码
- 定向输出NSLog 到沙盒路径下
- 2015应该学习的前端语言与框架
- 获取协议名、协议号——getprotoent(),getprotobyname(),getprotobynumber()
- 手机是如何泄密个人隐私的
- 调试lib
- zzuli OJ 1045: 数值统计
- codeforces 134B B. Pairs of Numbers(枚举+辗转相除)
- MVC学习地址
- 【技术】居中(不适用于IE7及以下版本)
- 经典算法之0-1背包问题
- 很让人受教的 提高php代码质量36计
- Win10预览版10532怎么样?Win10预览版10532上手演示视频
- 文件下载兼容各种浏览器
- exfat文件系统(七)------exfat_core.c详解(一)------CLUSTER HEAP(BMAP_DENTRY_T以及相关)
- windows下使用vfw方式生成AVI视频的实现
- windowsAPI之OpenProcessToken,AdjustTokenPrivileges 和LookupPrivilegeValue