The Average of N Students Marks
#include<stdio.h>
#include<conio.h>
void main()
{
int i,marks,sum=0,n;
float avge;
float avg(int,int);
clrscr();
printf("Enter The Number of Student::");
scanf("%d",&n);
printf("Enter %d Students Marks\n",n);
for(i=1;i<=n;i++)
{
printf("Enter %d Students Marks::",i);
scanf("%d",&marks);
sum=sum+a;
}
avge=avg(sum,n);
printf("The avg of %d Students Marks:: %f",n,avge);
getch();
}
float avg(int x,int n)
{
return(x/n);
}
/*
Output::
Enter The Number of Student::10
Enter 10 Students Marks
Enter 1 Students Marks::66
Enter 2 Students Marks::77
Enter 3 Students Marks::88
Enter 4 Students Marks::66
Enter 5 Students Marks::55
Enter 6 Students Marks::78
Enter 7 Students Marks::87
Enter 8 Students Marks::67
Enter 9 Students Marks::88
Enter 10 Students Marks::99
The avg of 10 Students Marks:: 77.000000
*/
No comments:
Post a Comment