Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[100],b;
- cout<<"Ivskite elementu skaiciu" << endl;
- cin>> b;
- for ( int i = 0; i < b; i++ )
- {
- cout<<"Iveskite elementa nr."<< i+1 <<endl;
- cin>> a[i];
- }
- for ( int i = 0; i < b; i++ )
- {
- if ( a[i] < 0) a[i]=1;
- }
- double vid=0;
- for ( int i = 0; i < b; i++ )
- {
- vid+=a[i];
- }
- vid/=b;
- cout<<"elementu vidurkis:"<<vid << endl;
- return 1;
- }
Add Comment
Please, Sign In to add comment