8.Write a C program to read marks scored in 3 subjects by n students and find the average
of marks and result (Demonstration of single dimensional array)
/*Write a C program to read marks scored in 3 subjects by n students and find the average
of marks and result (Demonstration of single dimensional array)*/
#include < stdio.h>
#include< conio.h>
void main()
{
int n, i;
int studnets[100], sub1[100],sub2[100],sub3[100];
float avg[100];
printf("Enter the numbers of studnets: ");
scanf("%d", &n);
for (i=0;i< n;i++)
{
printf("Enter the MARKS OF of studnet : %d ",i);
printf("\nsubject1:");
scanf("%d", &sub1[i]);
printf("\nsubject2:");
scanf("%d", &sub2[i]);
printf("\nsubject3:");
scanf("%d", &sub3[i]);
}
printf("Display Result ");
for (i=0;i< n;i++)
{
avg[i]=(sub1[i]+sub2[i]+sub3[i])/3;
if(avg[i] > 35)
printf("\n studnet %d is PASS : with %02f percent",i+1,avg[i]);
else
printf("\n studnet %d is FAIL : %02f percent",i+1,avg[i]);
}
getch();
}