Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an integer function (named the odd) implementing a loop that examines the

ID: 3772730 • Letter: W

Question

Write an integer function (named the odd) implementing a loop that examines the elements of a one-dimensional array of integers (provided through the calling arguments). The function calculates a sum of only the odd-valued elements. Return this sum. You may assume the length is contained in ARRAY_SIZE that is defined elsewhere and does not need to be passed as a calling argument. Given that ARRAY_SIZE is 5 and Z contains the values: 2,3,5,7,8, provide the result from the.odd (Z) Write an integer function (named abs_mat) that changes each element of an array of doubles to its absolute value. The array (provided through the calling arguments) is a square, two-dimensional array. You may assume the number of rows is contained in MAT_SIZE that is defined elsewhere. A library header file needs to be included to using the function fopen. Provide the include statement that would be used.

Explanation / Answer

6 a.

#include<stdio.h>
#include<conio.h>
int the_odd(int[] );
#define ARRAY_SIZE[10];

int main(){
int arr[ARRAY_SIZE]={1,2,3,4,5,6,7,8,9,12};

}


int the_odd(arr){
int cnt=0;
for(int i=0;i<ARRAY_SIZE-1;i++){
if(i/2!=0){
cnt=+i;
}
return cnt;
}

}

b.same as above just change ARRAY_SIZE value to 5.

======================
7.
#include<stdio.h>
#include<conio.h>
int main(){
double as[]={1.11,3.12,4.19}

for(int i=o;i<as.length;i++){
printf(abs(as[i]));
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote