[go: up one dir, main page]

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

Implement Structures To Read, W

The document provides a C program that defines a structure for student data, including USN, name, and marks in three subjects. It calculates the average marks for a given number of students and lists those who scored above or below the average. The program prompts for student details, computes totals and averages, and outputs the results accordingly.

Uploaded by

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

Implement Structures To Read, W

The document provides a C program that defines a structure for student data, including USN, name, and marks in three subjects. It calculates the average marks for a given number of students and lists those who scored above or below the average. The program prompts for student details, computes totals and averages, and outputs the results accordingly.

Uploaded by

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

10.

Implement structures to read, write and compute average- marks of the students,
list the students scoring above and below the average marks for a class of N
students.

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

struct student
{
char usn[10];
char name[10];
float m1,m2,m3;
float avg,total;
};

void main()
{
struct student s[20];
int n,i;
float avg,sum=0.0;
clrscr();
printf("Enter the number of student=");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter the detail of %d students\n",i+1);
printf("\n Enter USN=");
scanf("%s",s[i].usn);
printf("\n Enter Name=");
scanf("%s",s[i].name);
printf("Enter the three subject score\n");
scanf("%f%f%f",&s[i].m1,&s[i].m2,&s[i].m3);
s[i].total=s[i].m1+s[i].m2+s[i].m3;
s[i].avg=s[i].total/3;
}
for(i=0;i<n;i++)
{
if(s[i].avg>=35)
printf("\n %s has scored above the average marks",s[i].name);
else
printf(“\n %s has scored below the average marks”,s[i].name);
}
getch();
}

You might also like