/*
C PROGRAM FOR STUDENTS MARKSHEET USING STRUCTURES
*/
#include<stdio.h>
#include<conio.h>
struct stu
{
int rn,grade,a[5];
float avg;
}s[2];
void main()
{
int i,j,sum,n;
float avg;
clrscr();
printf("\t STUDENT MARKSHEET USING STRUCTURES\n\n");
printf("Enter the no of students");
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",s[i].rn);
for(j=0;j<=5;j++)
{
scanf("%d",&s[i].a[j]);
}
}
for(i=0;i<n;i++)
{
sum=0;
for(j=0;j<5;j++)
{
sum=sum+s[i].a[j];
s[i].avg=(float)(sum/5);
if(s[i].avg>=60)
s[i].grade=1;
else if(s[i].avg>50&&s[i].avg<60)
s[i].grade=2;
else
s[i].grade=3;
}
}
printf("****************************************\n");
printf("rn\ts1\ts2\ts3\ts4\ts5\tavg\t grade\n");
printf("*****************************************\n");
for(i=0;i<n;i++)
{
printf("%d\t",s[i].rn);
for(j=0;j<5;j++)
{
printf("%d\t",s[i].a[j]);
}
printf("%f\t%d\n",s[i].avg,s[i].grade);
}
getch();
}
OUTPUT:
STUDENTS
MARKSHEET USING STRUCTURES
Enter the no of students: 5
1
89 90 90 99 82
2
67 73 77 60 88
3
56 54 59 76 66
4
45 44 56 34 65
5
56 76 90 85 64
*********************************************************
Rn
s1 s2 s3 s4 s5 avg grade
*********************************************************
1 89 90 90 99 82 90.000000 1
2 67 73 77 60 88 71.000000 1
3 56 54 53 76 66 62.000000 1
4 45 44 56 34 65 48.000000 3
5 56 76 90 35 64 74.000000 1
thanks uv helped me wit my assignment big time
ReplyDeleteGreat informative blog. This really help me in may ways. Keep up the good work. Post more Anna University Question Paper. Students will like your blog for sure.
ReplyDeleteVisit My blog HERE and share your thoughts.