Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void main() {
- int br;
- int prosecnavrednost = 0;
- int n = 0;
- int suma = 0;
- FILE *f ,*fp;
- f = fopen("C:\\Users\\Nox Scourge\\Desktop\\brojevi1.txt", "r");
- fp = fopen("C:\\Users\\Nox Scourge\\Desktop\\pros.txt", "w");
- while (!feof(f)) {
- fscanf(f, "%d\n", &br);
- n++;
- suma += br;
- fprintf(fp, "%d\n", prosecnavrednost = suma / n);
- }
- fclose (f);
- fclose(fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement