您的位置:首页 > 其它

zzuli OJ 1046: 奇数的乘积

2015-08-28 16:16 162 查看

Description

给你n个整数,求他们中所有奇数的乘积。

Input

第一个数为n,表示本组数据一共有n个,接着是n个整数,你可以假设每组数据必定至少存在一个奇数。

Output

输出n个数中的所有奇数的乘积,占一行。

Sample Input

5 2 5 4 6 7

Sample Output

35

HINT

...

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: