Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include <conio.h>
- void main()
- {
- int i,n,np = 0,nn = 0,a[25];
- float poz = 0, neg = 0;
- cout<<"Dati macar o valoare negativa!!!"<<endl<<endl;
- cout<<"n=";cin>>n;
- for(i=0;i<n;i++)
- {
- cout<<"a["<<i+1<<"]=";cin>>a[i];
- if (a[i] > 0){
- poz=poz+a[i];np++;}
- else
- {neg=neg+a[i];nn++;}
- }
- poz=poz/np;
- neg=neg/nn;
- cout<<"Media aritmetica pozitiva este "<<poz<<endl;
- cout<<"Media aritmetica negative este "<<neg;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement