Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n,i,nr,s,v[201];
- int main()
- {
- cin>>n;
- for(i=1;i<=n;i++)
- {
- cin>>v[i]; //citirea vectorului
- if(v[i]!=0)
- {
- s=s+v[i]; //suma nenulelor
- nr++; //cate nr
- }
- }
- for(i=1;i<=n;i++)
- {
- if(v[i]==0)
- v[i]=s/nr; //inlocuirea nulelor
- cout<<v[i]<<" "; //afisare
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement