1到100之间的奇数项乘积好大,用double……
#include <stdio.h>
main()
{
int i,j,sum;
double pro;
for(i=1,sum=0;i<=100;i++)
sum+=i;
for(j=1,pro=1;j<100;j+=2)
pro*=j;
printf("sum=%d,pro=%d\n",sum,pro);
}
#include <stdio.h>
main()
{
int i,j,sum;
double pro;
for(i=1,sum=0;i<=100;i++)
sum+=i;
for(j=1,pro=1;j<100;j+=2)
pro*=j;
printf("sum=%d,pro=%d\n",sum,pro);
}