输入n个数,输出其中所有奇数的乘积?程序咋写?

学习 时间:2026-09-28 18:51:39 阅读:1822
输入n个数,输出其中所有奇数的乘积?程序咋写?

最佳回答

跳跃的抽屉

美好的抽屉

2026-09-28 18:51:39

#include <stdio。h>int main(){    int n;    int x;    int i;    int ans = 1;    scanf("%d",&n);    for (i=0;i<n;i++)    {            scanf("%d",&x);         if( x%2==1 ) ans = ans*x;    }    printf("%d\n",ans);    return 0;}

最新回答共有2条回答

  • 昏睡的电灯胆
    回复
    2026-09-28 18:51:39

    #include <stdio。h>int main(){    int n;    int x;    int i;    int ans = 1;    scanf("%d",&n);    for (i=0;i<n;i++)    {            scanf("%d",&x);         if( x%2==1 ) ans = ans*x;    }    printf("%d\n",ans);    return 0;}

上一篇 Please make a list of places----tourists to go to in shangha

下一篇 初中生英语手抄报版面设计图