You have a file with rows of numbers. Each row has a set number of Integers and you have to find the average for each row. The rows are unknown but we know how many integers there are in each row.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include <stdio.h> #include <stdlib.h> #define INTEGERS 3 int main(){ int i=0,num; float average=0; FILE *input; if(!(input=fopen("14_5_sel19.txt","r"))){ puts("Error opening file! Exiting"); return 1; } while(fscanf(input,"%d",&num)==1){ i++; average+=num; if(i==INTEGERS){ printf("average oros: %.2f\n",average/INTEGERS); i=0; average=0; } } fclose(input); return 0; } |

My husband and i got absolutely satisfied when Emmanuel managed to conclude his investigation from the precious recommendations he discovered through the weblog. It’s not at all simplistic to simply be freely giving guides some others could have been making money from. And we all know we’ve got the writer to appreciate for this. All the explanations you made, the simple site menu, the friendships your site make it easier to create – it’s mostly extraordinary, and it is letting our son and the family recognize that that issue is excellent, and that’s particularly pressing. Many thanks for all!
Great post. I was checking continuously this blog and I am impressed! Very helpful information specifically the last part
I care for such info a lot. I was looking for this particular information for a very long time. Thank you and best of luck.