#include #include #include #define N 50 int Student[N][10]; char Names[N][N]; void setName(int ID); void acceptDetails(int ID); void printDetails(int Num); int totalMarks(int id); float percentage(int id); void printThisStudent(int id); void displayClasswise(int Num); int main(){ int i=0; int j=0; int Num=0; printf("\n Enter number of students:"); scanf("%d",&Num); printf("\n Enter ID's for each student"); for(i=0;i scanf("%d",&Student[i][0]); } for(i=0;i setName(i); acceptDetails(i); } printDetails(Num); displayClasswise(Num); } void acceptDetails(int ID){ int k; printf("\n Enter details of %d",Student[ID][0]); k=1; printf("\n Sub1:"); scanf("%d",&Student[ID][k]); k++; printf("\n Sub2:"); scanf("%d",&Student[ID][k]); k++; printf("\n Sub3:"); scanf("%d",&Student[ID][k]); k++; printf("\n Sub4:"); scanf("%d",&Student[ID][k]); k++; printf("\n Int1:"); scanf("%d",&Student[ID][k]); k++; printf("\n Int2:"); scanf("%d",&Student[ID][k]); k++; printf("\n Int3:"); scanf("%d",&Student[ID][k]); k++; printf("\n Int4:"); scanf("%d",&Student[ID][k]); } void printDetails(int Num){ int i=0,j=0,k=0; int count = 0; printf("\n ID \t name \t s1 \t s2 \t s3 \t s4 \t i1 \t i2 \t i3 \t i4 \t tot \t per "); for(i=0;i printf("\n"); count=0; for(j=0;j<9 b="" j="">9> printf("%d",Student[i][j]); printf("\t"); count++; if(count==1){ while(Names[i][k] != '\0'){ printf("%c",Names[i][k]); k++; } printf("\t"); } if(count==9){ printf("%d",totalMarks(i)); printf("\t"); printf("%.02f",percentage(i)); } } printf("\n"); } } int totalMarks(int id){ int i=0,j=0; int sum=0; for(j=1;j<9 b="" j="">9> sum = sum + Student[id][j]; } return sum; } float percentage(int id){ float per = 0; per = ((totalMarks(id))/8); return per; } void setName(int id){ printf("\n Enter name:"); scanf("%s",Names[id]); getchar(); } void displayClasswise(int Num){ int i=0; printf("\n Fail:"); for(i=0;i if(percentage(i) < 40){ printThisStudent(i); } } printf("\n 3rd Class:"); for(i=0;i if(percentage(i) >40 && percentage(i) < 50){ printThisStudent(i); } } printf("\n 2nd Class:"); for(i=0;i if(percentage(i) >50 && percentage(i) < 60){ printThisStudent(i); } } printf("\n 1st Class:"); for(i=0;i if(percentage(i) >60 && percentage(i) < 70){ printThisStudent(i); } } printf("\n Distinction:"); for(i=0;i if(percentage(i) > 70){ printThisStudent(i); } } } void printThisStudent(int id){ int count = 0; int j=0; int k=0; printf("\n ID \t name \t s1 \t s2 \t s3 \t s4 \t i1 \t i2 \t i3 \t i4 \t tot \t per "); count=0; for(j=0;j<9 b="" j="">9> printf("%d",Student[id][j]); printf("\t"); count++; if(count==1){ while(Names[id][k] != '\0'){ printf("%c",Names[id][k]); k++; } printf("\t"); } if(count==9){ printf("%d",totalMarks(id)); printf("\t"); printf("%.02f",percentage(id)); } } }
Hello, My name is Jagadesha H, Studying M.Sc in Computer Science from South Asian University, New Delhi. I am a programmer, web designer and developer having a good knowledge of HTML, HTML5, CSS3, PHP, JavaScript, Ajax, JQuery, MySQL, MySQL and also i have a good knowledge of C, C++, Java and am learning MAT-LAB. following are the links to the websites i have developed, http://www.tesseractconsulting.in http://www.propertycaretakersindia.com My email ID: jagadeshanh@gmail.com
Monday, September 2, 2013
Storing Student Records Using Array In 'C'
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment