0% found this document useful (0 votes)
9 views1 page

L10. Use Structures To Read, Write and Compute Average-Marks of N Students. Also, List The Students Scoring Above and Below The Average Marks

Uploaded by

shreeumaluti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

L10. Use Structures To Read, Write and Compute Average-Marks of N Students. Also, List The Students Scoring Above and Below The Average Marks

Uploaded by

shreeumaluti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

L10. Use structures to read, write and compute average- marks of N students.

Also, list the


students scoring above and below the average marks.
/* structures to read, write and compute printf("Input marks of %d students: \n",n);
average- marks of N students, list the for(i=0; i<n; i++)
students above and below the average marks {
*/ printf("%s: ",s[i].name);
#include<stdio.h> printf("%0.1f\n",s[i].marks);
int main() }
{
avg_marks=sum/n;
struct student
printf("Average marks of students= %0.1f \n",avg_marks);
{
char name[40]; printf("List of students with above average marks: \n");
float marks; for(i=0; i<n; i++)
}; {
struct student s[100]; if(s[i].marks>avg_marks)
int n, i; {
float sum=0,avg_marks; printf("%s: ",s[i].name);
printf("%0.1f\n",s[i].marks);
printf("structures to list students scoring }
above and below average marks: \n"); }
printf("How many students?:"); printf("List of students with below average marks: \n");
scanf("%d",&n); for(i=0; i<n; i++)
{
printf("Enter name and marks of %d students: if(s[i].marks<avg_marks)
\n",n); {
for(i=0; i<n; i++) printf("%s: ",s[i].name);
{ printf("%0.1f\n",s[i].marks);
scanf("%s",s[i].name); }
scanf("%f",&s[i].marks); }
sum=sum+s[i].marks; }
}

You might also like