Please show how the following C programs output 449 include

Please show how the following C program\'s output =449:

#include <stdio.h>

void fM (int m[10])
{ for (int i=0;i<10; i+=2) {
m[i]=m[i]+2;
}
}

int main (void){
int iarray[10]={2,4,7,9,11,23};
fM(iarray);
printf(\"%d %d %d\ \",iarray[0],iarray[1],iarray[2]);

return 0; }

Solution

Answer: 4 4 9

In this program, we have int array with 6 numbers. we are passing array and adding 2 value to alternate element in array starts from 0,2,4

So here int array values are int iarray[10]={2,4,7,9,11,23};

Inside this fM(iarray); method we are adding 2 value to alternate elements m[i]=m[i]+2;

After calling fM(iarray); this function arrray elements are {4,4,9,9,13,23}

So hen we are printing these locations iarray[0],iarray[1],iarray[2], it will print like 4 4 9

Please show how the following C program\'s output =449: #include <stdio.h> void fM (int m[10]) { for (int i=0;i<10; i+=2) { m[i]=m[i]+2; } } int main (

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site