Write a C program to store marks of 5 students in 3 subjects and display its total row wise using two dimensional array."
Answers
Answered by
3
Explanation:
#include<stdio.h>
int main(){
/* 2D array declaration*/
int disp[2][3];
/*Counter variables for the loop*/
int i, j;
for(i=0; i<2; i++) {
for(j=0;j<3;j++) {
printf("Enter value for disp[%d][%d]:", i, j);
scanf("%d", &disp[i][j]);
}
}
//Displaying array elements
printf("Two Dimensional array elements:\n");
for(i=0; i<2; i++) {
for(j=0;j<3;j++) {
printf("%d ", disp[i][j]);
if(j==2){
printf("\n");
}
}
}
return 0;
Similar questions
English,
2 months ago
Math,
2 months ago
Business Studies,
4 months ago
Math,
4 months ago
Physics,
10 months ago