Sum and average of Marks by using Array |
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum=0,marks[50];
float avg;
printf("\nEnter the number of students : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nEnter the student Marks : ");
scanf("%d",&marks[i]);
sum = sum + marks[i];
}
printf("\nThe sum of the Student Marks are %d",sum);
avg = (float)sum/n;
printf("\nThe Average Student Mark is %.2f",avg);
getch();
}
0 Comments