World's most popular travel blog for travel bloggers.

Write an algorithm and its corresponding C program to generate students’ Progress-Report for VIII standard (section of 20 students) of a CBSE school for all its 4 terms. Use Structures concept. Assumptions can be made wherever necessary.

, , No Comments

Ans.
struct  student
{
char name[25];
 int roll_no;
int t1s1,t1s2,t1s3,t1s4,t1s5, t2s1,t2s2,t2s3,t2s4,t2s5, t3s1,t3s2,t1s3,t3s4,t3s5;
int t4s1,t4s2,t4s3,t4s4,t4s5;
float per;
}std[20];
void main()
{
int i;
for(i=0;i<=20;i++)
{
printf(“enter name of student %d”,(i+1));
gets(std[i].name);
printf(“enter roll no of student %d”,(i+1));
scanf(“%d”,&std[i].roll_no);
printf(“enter marks of student %d of term 1”,(i+1));

scanf(“%d”,&std[i].t1s1);
scanf(“%d”,&std[i].t1s2);
scanf(“%d”,&std[i].t1s3);
scanf(“%d”,&std[i].t1s4);
scanf(“%d”,&std[i].t1s5);
printf(“enter marks of student %d of term 2”,(i+1));
scanf(“%d”,&std[i].t2s1);
scanf(“%d”,&std[i].t2s2);
scanf(“%d”,&std[i].t2s3);
scanf(“%d”,&std[i].t2s4);
scanf(“%d”,&std[i].t2s5);
printf(“enter marks of student %d of term 3”,(i+1));
scanf(“%d”,&std[i].t3s1);
scanf(“%d”,&std[i].t3s2);
scanf(“%d”,&std[i].t3s3);
scanf(“%d”,&std[i].t3s4);
scanf(“%d”,&std[i].t3s5);
printf(“enter marks of student %d of term 4”,(i+1));
scanf(“%d”,&std[i].t4s1);
scanf(“%d”,&std[i].t4s2);
scanf(“%d”,&std[i].t4s3);
scanf(“%d”,&std[i].t4s4);
scanf(“%d”,&std[i].t4s5);
pert1= (std[i].t1s1+ std[i].t1s2+ std[i].t1s3+ std[i].t1s4+ std[i].t1s5)/500;
pert2= (std[i].t2s1+ std[i].t2s2+ std[i].t2s3+ std[i].t2s4+ std[i].t2s5)/500;
pert3= (std[i].t3s1+ std[i].t3s2+ std[i].t3s3+ std[i].t3s4+ std[i].t3s5)/500;
pert4=( std[i].t4s1+ std[i].t4s2+ std[i].t4s3+ std[i].t4s4+ std[i].t4s5)/500;
for(i=0;i<20;i++)
{
printf(“\n Name of student \t”,(i+1));
puts(std[i].name);
printf(“\n Roll no:%d”,std[i].roll_no);
printf(“\n term 1”);
printf(“English: %d”, std[i].t1s1);
printf(“Hindi: %d”, std[i].t1s2);
printf(“ Maths: %d”, std[i].t1s3);
printf(“Science:%d”, std[i].t1s4);
printf(“Social Science:%d”, std[i].t1s5);
printf(“  percentage : %f”,pert1);
printf(“\n term 2”);
printf(“English: %d”, std[i].t1s1);
printf(“Hindi: %d”, std[i].t1s2);
printf(“ Maths: %d”, std[i].t1s3);
printf(“Science:%d”, std[i].t1s4);
printf(“Social Science:%d”, std[i].t1s5);
printf(“  percentage : %f”,pert1);
printf(“\n term 3”);
printf(“English: %d”, std[i].t1s1);
printf(“Hindi: %d”, std[i].t1s2);
printf(“ Maths: %d”, std[i].t1s3);
printf(“Science:%d”, std[i].t1s4);
printf(“Social Science:%d”, std[i].t1s5);
printf(“  percentage : %f”,pert1);
printf(“\n term 4”);
printf(“English: %d”, std[i].t1s1);
printf(“Hindi: %d”, std[i].t1s2);
printf(“ Maths: %d”, std[i].t1s3);
printf(“Science:%d”, std[i].t1s4);
printf(“Social Science:%d”, std[i].t1s5);
printf(“  percentage : %f”,pert1);
}
}
}

0 comments:

Post a Comment

Let us know your responses and feedback