Answer:
The C code is given below with appropriate comments
Explanation:
#include <stdio.h>
int main()
{
//array declaration
int arr[3][7], cumulativeSum = 0;
//initialize the array
for(int i=0; i<3; i++)
{
for(int j=0; j<7; j++)
{
arr[i][j] = i+j;
}
}
//calculate the cumulative sum
for(int i=0; i<3; i++)
{
for(int j=0; j<7; j++)
{
if((arr[i][j] % 5) != 0)
{
cumulativeSum += arr[i][j];
arr[i][j] = 0;
}
}
}
//display the final array
printf("The final array is: \n\n");
for(int i=0; i<3; i++)
{
for(int j=0; j<7; j++)
{
printf("%d ", arr[i][j]);
}
printf("\n");
}
//display the cumulative sum
printf("\nCumulative Sum = %d", cumulativeSum);
return 0;
}