#include<stdio.h>
#include<conio.h>
void main()
{ clrscr();
int
a[100],i,j,sum=0;
float avg,n;
printf("Input
number of students=");
scanf("%f",&n);
//input section
for(i=0;i<n;i++)
{ scanf("%d",&a[i]);
}
//output section
for(i=0;i<n;i++)
{ printf(" %d",a[i]);}
//sum section
for(i=0;i<n;i++)
{ sum=sum+a[i];
}
//average section
avg=sum/n;
printf("\n
sum=%d avg=%f",sum,avg);
getch();
}
No comments:
Post a Comment
Please comment bellow. Share your knowledge