Advertisement

You’ve to enter 10 marks:: This will calculate highest, lowest and average marks::(Array)


#include<conio.h>
#include<stdio.h>
void main()
{clrscr();
int a[10],i,n,m;
float b;
printf("enter the numbers of 10 students");
n=1;
for(i=0;i<=9;i++)
{printf("\n %d.",n);
scanf("%d",&a[i]);
n++;}
n=1;
for(i=0;i<=9;i++)
{printf("\n %d.",n);
printf("%d",a[i]);
n++;}
printf("\n \n calculation of highest marks");
m=a[0];
for(i=0;i<=9;i++)
{if(m<a[i])
m=a[i];}
printf("\n %d",m);
printf("\n \n calculation for lowest marks");
m=a[0];
for(i=0;i<=10;i++)
{if(m>a[i])
m=a[i];}
printf("\n %d",m);
printf("\n \n calculation of mean of the marks");
m=0;
for(i=0;i<=9;i++)
{m=m+a[i];}
b=m/10;
printf("\n %f",b);
getch();}

No comments:

Post a Comment

Please comment bellow. Share your knowledge