-->

Header Ads

WAP to find Average of given marks of student as array element.

C Program:

#include<stdio.h>
#include<conio.h>
void main()
{
int avg,sum=0,a;
int mark[5];
clrscr();
for(a=0;a<5;a++)
{
printf("\n enter no:");
scanf("%d",&mark[a]);
}
for(a=0;a<5;a++)
{
sum+=mark[a];
avg=sum/5;
}
printf("\n sum marks :%d ",sum);

printf("\n avg. marks :%d ",avg);

getch();
}

Output of c program:


No comments

Powered by Blogger.