#include<stdio.h> #include<conio.h> int main() { int rows,i,j,ch,data; int arr[20][6]; clrscr(); printf("Enter number of Students : "); scanf("%d",&rows); for(i=0;i<rows;i++) { for(j=0;j<5;j++) { int marks; printf("Enter marks of %d student and %d subject : ",i+1,j+1); scanf("%d",&marks); arr[i][j]=marks; } } for(i=0;i<rows;i++) { int sum=0; for(j=0;j<5;j++) { sum+=arr[i][j]; } printf("Total of %dth student is : %d \n",i+1,sum); printf("Average of %dth student is %d\n",i+1,sum/5); } printf("Do you want to change data Press 1 for Yes and 0 for No :"); scanf("%d",&ch); if(ch) { printf("Type student No :"); scanf("%d",&i); printf("Type subject No :"); scanf("%d",&j); printf("Enter new data :"); scanf("%d",&data); arr[i-1][j-1]=data; //Print Updated Data for(i=0;i<rows;i++) { for(j=0;j<5;j++) { printf("%d ",arr[i][j]); } printf("\n"); } } getch(); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter