In: Computer Science
In the space provided below write a ******C program********* that asks the user to enter their quarterly earnings for the past two years stores the data in a 2-dimensional array. The program then computes both the annual earnings as well as the total earning and prints the results along with the 2-dimensional array on screen.
Using the embed icon shown above, also include screenshots demoing the execution of your program. Please write carefully. Thank you
#include <stdio.h>
int main(){
int arr1[2][4];
int arr2[2] = {0, 0};
int i, j;
for (i = 0; i < 2; i++){
printf("Enter Quarterly earnings for year %d : ", i + 1);
for (j = 0; j < 4; j++){
scanf("%d", &arr1[i][j]);
arr2[i] = arr2[i] + arr1[i][j];
}
}
printf("Quarterly earnings of 2 years printed as 2D array:\n");
for (i = 0; i < 2; i++){
for (j = 0; j < 4; j++)
printf("%d ", arr1[i][j]);
printf("\n");
}
printf("Annual earnings : \n");
printf("year 1 = %d",arr2[0]);
printf("\nyear 2 = %d",arr2[1]);
printf("\n\nTotal earnings : %d",arr2[0]+arr2[1]);
return 0;
}