Assuming that the following integer array Arraylnts [] = {54, 152, 99, -8, 3, 19
ID: 3865398 • Letter: A
Question
Assuming that the following integer array Arraylnts [] = {54, 152, 99, -8, 3, 19, -11, 260, 27, -4, 10, 12, 15, 58, 480, 60}: is stored in the memory. Write a complete C language program that: computes the sum of all even integers in the array and displays the result on the console, computes the sum of all odd integers in the array and displays the result on the console, and Searches the array for the target value of the sum of all odd integers using Binary Search. If the target value was found within the array, a message indicating array index at which the target value was found should be displayed on the console otherwise "Target was not found" should be displayed.Explanation / Answer
#include<stdio.h>
void main()
{
int ArrayInts[]=[54,152,99,-8,3,19,-11,260,27,-4,10,12,15,58,480,60};
int sumofeven=0;
int sumofodd=0;
int n=16,swap;
for(int i=0;i<n;i++)
{
if(ArrayInt[i]%2==0)
sumofeven +=arrayInt[i];
else
sumofodd +=arrayInt[i];
}
printf("sum of even numbers in the ArrayInt is: %d", sumofeven);
printf("sum of odd numbers in the ArrayInt is: %d", sumofodd);
for(int i=0;i<(n-1);i++)
int search=sumofodd;
int first=0;
}