Question
PLEASE CONVERT THIS PROGRAM INTO FUNCTION I HAVE MENTIONED BELOW INSIDE THE CODE WHICH PART #include void main() { int i, j, k, marks[10][10], total[10],
PLEASE CONVERT THIS PROGRAM INTO FUNCTION I HAVE MENTIONED BELOW INSIDE THE CODE WHICH PART
#include
void main() { int i, j, k, marks[10][10], total[10], n; printf("Input elements in the matrix : "); for (i = 1; i < 6; i++) { for (j = 1; j < 5; j++) { printf("Enter marks of Student [%d] for Subject [%d] : ", i, j); scanf("%d", & marks[i][j]); } }
/*PLEASE CONVERT THE BELOW INTO FUNCTION WHERE ITS OUTPUT IS RETURNED TO MAIN FUNCTION */ printf("The matrix is : "); for (i = 1; i < 6; i++) { for (j = 1; j < 5; j++) printf("% 4d", marks[i][j]); printf(" "); }
/* This part of code find total of the marks */ for (i = 1; i < 6; i++) { total[i] = 0; for (j = 1; j < 5; j++) total[i] = total[i] + marks[i][j]; }
printf("The sum of marks are written in last column : "); for (i = 1; i < 6; i++) { for (j = 1; j < 5; j++) printf("% 4d", marks[i][j]); printf(" =% 8d", total[i]); printf(" "); } printf(" "); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started