Skip to content

Instantly share code, notes, and snippets.

@Senderman
Created October 21, 2018 17:49
Show Gist options
  • Save Senderman/1ceaac80cfaeb434c42eba000e99d02c to your computer and use it in GitHub Desktop.
Save Senderman/1ceaac80cfaeb434c42eba000e99d02c to your computer and use it in GitHub Desktop.
Для Ани
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
srand(time(NULL));
int str, slb;
int kol=0;
int sr=0;
cout<<"vvedite stroki i stolbci"<<endl;
str=rand()%15+1;
slb=rand()%15+1;
cout<<str<<" "<<slb<<endl<<"vvedite elementi"<<endl;
int arr[str][slb];
for (int i=0; i<str; i++) {
for (int j=0; j<slb; j++) {
arr[i][j]=rand()%200-100;
cout<<arr[i][j]<<" ";
if (arr[i][j]<-1) {
sr+=arr[i][j];
kol++;
}
}
cout<<endl;
}
sr=sr/kol;
cout<<"srednee ravno "<<sr<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment