1085: 求奇數的乘積(多例項測試)(奇數判斷)

毛鵬勃發表於2020-11-28
#include <stdio.h>
int main()
{
    int n, i, j, sum, k;
    sum = 1;
    while (scanf("%d", &n) != EOF)
    {
        for (k = 0; k < n; k++)
        {
            scanf("%d", &j);
            if (j % 2 != 1) //判斷是否為奇數
                sum *= j;
            /* code */
        }
        printf("%d\n", sum);
        sum = 1;
    }
    return 0;
}

相關文章