To find the product of odd numbers
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 56573 Accepted Submission (s): 36490
Problem Description
give you n integers and ask for the product of all the odd numbers in them.
Input
The input data contains multiple test instances, one row per test instance, and the first number of each row is n, indicating that there is a total of n for this group of data, followed by n integers, you can assume that each set of data must have at least one odd.
Output
Outputs all the odd multiples of each set of numbers, and one row for the test instance.
Sample Input
3 1 2 3
4 2 3) 4 5
Sample Output
3
15
Author
Lcy
Source
C Language Programming exercises (i)
#include <stdio.h>
int main ()
{
int n,sum,i,b;
while (scanf ("%d", &n)!=eof)
{
Sum=1;
for (i=0;i<n;i++)
{
scanf ("%d", &b);
if (b%2==1)
Sum*=b;
}
printf ("%d\n", sum);
}
return 0;
}
To find the product of odd number AC Hangzhou electric