Computer Science, asked by vasavilankamp3blje, 10 months ago

Program to find average of numbers stored in sequential access file

Answers

Answered by TIYACHAKRAWARTI
7

Explanation:

int main()

{

int num1, num2, num3, num4, sum, gsize;

FILE *inFile;

char fname[30];

printf("Enter a file name: ");

gets(fname);

inFile = fopen(fname, "r");

if (inFile == NULL)

{

printf("\nFailed to open file.\n");

exit(1);

}

while (fscanf(inFile, "%d %d %d %d %d %d",&gsize, &num1, &num2, &num3, &num4) != EOF)

{

printf("Group Size = %d\n num1 = %-12d num2 = %-18d num3 = %-24d num4 = %-30d %d\n", gsize, num1, num2, num3, num4, sum);

}

fclose(inFile);

}

plZ mark me as a brainlist

Answered by Amrishaverma
2

Answer:

Your program to find average of numbers.

Attachments:
Similar questions