Max running time : So i's trying to solve a problem and ive run into a bit of an issue 
So i have to find the running average of a series of numbers 
for input 4 2 7 
    output 4 3 4.3333

Now heres the problem although i get the answer its not the precise answer
 
[accuracy difference shown in the image][1]

i cant find whats wrong , some help would be highly appreciated !

    #include<stdio.h>

    main(){
    int n;
    printf("set:");
    scanf("%d",&n);
    float arr[n],resarr[n];
    float sum=0;

    for(int i=1; i<=n; i++){
        scanf("%f",&arr[i]);
        sum=arr[i]+sum;

        float res= sum/(float)i;
        resarr[i]=res;
    }
    int i=1;
    while(i<=n){
        printf("%0.10f\n",resarr[i]);
        i++;
    }

    return 0;
    }
 


  [1]: https://i.stack.imgur.com/REO0W.png