c program of structure with array

#include<conio.h>
#include<stdio.h>
struct stu {
int roll,h,en,s,sum,per;
char name[20];};

void main()
{struct stu e[10];
int i,sum,per;
clrscr();
for(i=0;i<=1;i++)
{
printf("enter emp no:\t");
scanf("%d",&e[i].roll);

printf("enter name:\t");
scanf("%s",e[i].name);

printf("enter marks of hindi,english,science:\n");
scanf("%d%d%d",e[i].h,e[i].en,e[i].s);

sum=e[i].h+e[i].en+e[i].s;
per=(sum*100)/3;}

printf("Emp no.\t\tName\tHindi\tEnglish\tScience\tTotal\tPercentage\n");

for(i=0;i<=10;i++)
{
printf("%d\t\t%s\t%d\t%d\t%d\t%d\t%d\n",e[i].roll,e[i].name,e[i].h,e[i].en,e[i].s,sum,per);
}
getch();
}

Comments

Popular posts from this blog