Code:

#include <stdio.h>
#include <math.h>
main()
{
//Declares the variables and the sums and averages
double count = 1, sum, avg, n1, n2, n3, sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0, sum5 = 0,
avg1, avg2, avg3, avg4, avg5, sd1, sd2, sd3, sd4, sd5;
//Open the input and output files
FILE *inp, *outp;
inp = fopen("input.dat", "r");
outp = fopen("result.out", "w");
//Displays the format of the table
printf("Count #1 #2 #3 Sum Avg\n");
printf("_____ _____ _____ _____ _____ _____\n");
fprintf(outp, "Count #1 #2 #3 Sum Avg\n");
fprintf(outp, "_____ _____ _____ _____ _____ _____\n");
//Loops to read and display all numbers from the file
while(count<=16)
{
fscanf(inp, "%lf%lf%lf", &n1,&n2,&n3);
sum = n1 + n2 + n3;
sum1 = sum1 + n1;
sum2 = sum2 + n2;
sum3 = sum3 + n3;
avg = sum/3;
sum4 = sum4 + sum;
sum5 = sum5 + avg;
avg1 = sum1/16;
avg2 = sum2/16;
avg3 = sum3/16;
avg4 = sum4/16;
avg5 = sum5/16;
sd1 = sqrt((pow((n1-avg1),2))/16);
sd2 = sqrt((pow((n2-avg2),2))/16);
sd3 = sqrt((pow((n3-avg3),2))/16);
sd4 = sqrt((pow((sum-avg4),2))/16);
sd5 = sqrt((pow((avg-avg5),2))/16);
printf("%5.0f %6.3f %6.3f %6.3f %6.3f %6.3f\n", count,n1,n2,n3,sum,avg);
count++;
}
printf("_____ _____ _____ _____ _____ _____\n");
printf("Sum %6.3f %6.3f %6.3f %6.3f %6.3f\n", sum1,sum2,sum3,sum4,sum5);
printf("_____ _____ _____ _____ _____ _____\n");
printf("Average %6.3f %6.3f %6.3f %6.3f %6.3f\n", avg1,avg2,avg3,avg4,avg5);
printf("_____ _____ _____ _____ _____ _____\n");
printf("Standard\nDeviation %6.3f %6.3f %6.3f %6.3f %6.3f\n", sd1,sd2,sd3,sd4,sd5);

The reason I didn't name the variables well is because we've reused the same program but modified it several times and I was too lazy to rename everything every time.