#include<stdio.h>
int main()
{
int n,i,a[100];
while(scanf("%d",&n)!=EOF) error C2466: cannot allocate an array of constant size 0
{ 不能在此int a[n];否则error C2133: 'a' : unknown size;error C2057: expected constant expression;
int s=1;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]%2!=0)
s=s*a[i];
}
printf("%d\n",s); //若掉\n则Presentation Error
}
return 0;
}
code2:
#include<stdio.h>
int main()
{
int n,i,m; //可用m替换a[i];
while(scanf("%d",&n)!=EOF)
{
int s=1;
for(i=0;i<n;i++)
{
scanf("%d",&m);
if(m%2!=0)
s=s*m;
}
printf("%d\n",s);
}
return 0;
}