Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Comment



Test expression



Header file



Working with switch case



Iterative statement




Array 2_D - calculate marks of 5 students in 3 subject and display the highest marks in each subject




// AHF C PROGRAM SOLVING

//solving here 2_D   ARRAY 	programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { int marks[5][3],i,j,large; for(i=0;i < 5;i++) { pf("\n"); pf("Enter the marks of 3 subject obtain by the student %d: ",i); for(j=0;j < 3;j++) scanf("%d",&marks[i][j]); } for(i=0;i < 5;i++) { int large=-1; pf("\nThe highest number of 3 subject obtain by student: %d = ",i); for(j=0;j < 3;j++) { if(marks[i][j]>large) large=marks[i][j]; } pf(" %d",large); } }
OUTPUT:


© 2018 - All rights reserved