Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- void main() {
- float srednjavrednost;
- float broj;
- int suma = 0;
- float i = 0;
- float prosecnavrednost = 0;
- printf("Unesite srednju vrednost");
- scanf("%f", &srednjavrednost);
- FILE *f = fopen("C:\\Users\\Nox Scourge\\Desktop\\zadatak.txt", "r");
- while (prosecnavrednost < srednjavrednost) { //nema !feof jer ne moee da se izvede tako
- fscanf(f, "%f", &broj);
- i++;
- suma += broj;
- prosecnavrednost = suma / i;
- if (prosecnavrednost > srednjavrednost) {
- printf("Presli ste pocetnu vrednost =%f , vrednost je =%f \n", srednjavrednost, prosecnavrednost);
- }
- }
- fclose(f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement