Tuesday, December 25, 2012

C - Structure : 3 Students Marksheet


#include<stdio.h>
#include<conio.h>

struct std
{
char nm[10],dep[10];
int t,id;
float p;

}v[5];
void main()
{
int i,j,a[6],t;
float p;
clrscr();

for(i=0;i<3;i++)
{
printf("Enter Student Name : ");
gets(v[i].nm);
printf("Enter Department : ");
gets(v[i].dep);
printf("Enter ID Number : ");
scanf("%d",&v[i].id);

for(j=1;j<6;j++)
{
printf("\nEnter Subject %d Marks : ",j);
scanf("%d",&a[j]);
t=t+a[j];
}
p=t*500/100;
fflush(stdin);
printf("\n\n");
}
clrscr();
printf("\n\n\n\n");

for(i=0;i<3;i++)
{
printf("\n\n\n\n");
printf("Student Name : %c\nDepartment : %c\nID Number : %d\nPercentage %f",v[i].nm,v[i].dep,v[i].id,v[i].p);

for(j=1;j<6;j++)
{
printf("\n\n\tSubject %d Marks = %d",j);
}
}

getch();
}

No comments:

Post a Comment