100% found this document useful (2 votes)
4K views

C Program For Marksheet Using Structures

The document defines a structure called mark_sheet to store student details like name, roll number, marks of 5 subjects, total marks, average, class, and result. It then declares an array of 100 such structures to store details of multiple students. The main function takes input of number of students, then loops through each student to take details as input and calculate total, average, class and result and prints the mark sheet. It also has option to print details of next student.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
4K views

C Program For Marksheet Using Structures

The document defines a structure called mark_sheet to store student details like name, roll number, marks of 5 subjects, total marks, average, class, and result. It then declares an array of 100 such structures to store details of multiple students. The main function takes input of number of students, then loops through each student to take details as input and calculate total, average, class and result and prints the mark sheet. It also has option to print details of next student.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<stdio.

h> }
#include<conio.h> for(a=1;a<=n;++a){
struct mark_sheet{ clrscr();
char name[20]; printf("\n\n\t\t\t\tMark Sheet\n");
long int rollno; printf("\nName of Student : %s",
int marks[10]; students[a].name);
int total; printf("\t\t\t\t Roll No : %ld", students[a].rollno);
float average; printf("\n---------------------------------------");
char rem[10]; for(b=1;b<=5;b++){
char cl[20]; printf("\n\n\t Subject %d \t\t :\t %d", b,
}students[100]; students[a].marks[b]);
int main(){ }
int a,b,n,flag=1; printf("\n\n---------------------------------\n");
char ch; printf("\n\n Totl Marks : %d", students[a].total);
clrscr(); printf("\t\t\t\t Average Marks : %5.2f",
printf("How many students : \n"); students[a].average);
scanf("%d",&n); printf("\n\n Class : %s", students[a].cl);
for(a=1;a<=n;++a){ printf("\t\t\t\t\t Status : %s", students[a].rem);
clrscr(); printf("\n\n\n\t\t\t\t Press Y for continue . . . ");
printf("\n\nEnter the details of %d students : ", n- ch = getche();
a+1); if((ch=="y")||(ch=="Y"))
printf("\n\nEnter student %d Name : ", a); continue;
scanf("%s", students[a].name); }
printf("\n\nEnter student %d Roll Number : ", a); return(0);
scanf("%ld", &students[a].rollno); }
students[a].total=0; _______________________________________
for(b=1;b<=5;++b){ Sample Outputs:
printf("\n\nEnter the mark of subject-%d : ", b); How many students : 2
scanf("%d", &students[a].marks[b]); Enter the details of 2 students :
students[a].total += students[a].marks[b]; Enter student 1 Name : H.Xerio
if(students[a].marks[b]<40) Enter student 1 Roll Number : 536435
flag=0; Enter the mark of subject-1 : 46
} Enter the mark of subject-1 : 56
students[a].average = (float) (students[a].total) / Enter the mark of subject-1 : 76
5.0; Enter the mark of subject-1 : 85
if((students[a].average>=75)&&(flag==1)) Enter the mark of subject-1 : 75
strcpy(students[a].cl,"Distinction"); Mark Sheet
else Name of Student : H.Xerio Roll No : 536435
if((students[a].average>=60)&&(flag==1)) ----------------------------------------------------------------
strcpy(students[a].cl,"First Class"); subject 1 : 46
else subject 2 : 56
if((students[a].average>=50)&&(flag==1)) subject 3 : 76
strcpy(students[a].cl,"Second Class"); subject 4 : 85
else subject 5 : 75
if((students[a].average>=40)&&(flag==1)) ---------------------------------------------------------------
strcpy(students[a].cl,"Third Class"); Totl Marks : 338 Average Marks :
if(flag==1) 67.6
strcpy(students[a].rem,"Pass"); Class : First Class Status : Pass
else
strcpy(students[a].rem,"Fail"); Press Y for continue . . .
flag=1;

You might also like