Created
October 21, 2018 17:49
-
-
Save Senderman/1ceaac80cfaeb434c42eba000e99d02c to your computer and use it in GitHub Desktop.
Для Ани
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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