Advertisement

Determination of average using array


#include<stdio.h>
#include<conio.h>
void main()
{   clrscr();
    int grade[10],i,sum=0;
    float average;
    for(i=0;i<5;i++)
    {printf("Enter grade[%d]:",i+1);
    scanf("%d",&grade[i]);
    sum+=grade[i];}
    average=(float)(sum)/5.0;
    printf("\n\n\n\n average is=%f",average);
    getch();



                     }

No comments:

Post a Comment

Please comment bellow. Share your knowledge