Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream.h>
- #include<iomanip.h>
- int main(){
- ifstream f1("numere.txt");
- int x,i=0;
- float ma,s=0;
- while(f1>>x)
- if(x>0){
- s=s+x;
- i++;}
- ma=s/i;
- f1.close();
- cout<<fixed<<setprecision(2)<<ma;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement