Question

Implement and test a parallel program that sum only the odd numbers of an array using...

Implement and test a parallel program that sum only the odd numbers of an array using the c programming language

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code and output

lain. 1 : #include <stdio.h> 2 int main() 3-{ 4 int a[1000],s,sum=0,i; 5 printf(Enter the size of the array : ); 6 scanf(%

Coode for copying

#include <stdio.h>
int main()
{
int a[1000],s,sum=0,i;
printf("Enter the size of the array : ");
scanf("%d",&s);
printf("Enter the array elements : ");
for(i=0;i<s;i++)
{
scanf("%d",&a[i]);
}
for (i=0;i<s;i++)
{
if (a[i]%2==1)
{
sum+=a[i];
}
}
printf("The sum of odd numbers is %d",sum);
return 0;
}

Add a comment
Know the answer?
Add Answer to:
Implement and test a parallel program that sum only the odd numbers of an array using...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT