Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <time.h>
- #include <iomanip>
- #define n 8
- using namespace std;
- int main()
- {
- setlocale(LC_ALL,"");
- int i,j,A[n][n],summa=0,max=0;
- srand(time(NULL));
- for(i=0;i<n;i++){
- for(j=0;j<n;j++){
- A[i][j]=rand()%100-20;}}
- for(i=0;i<n;i++){
- for(j=0;j<n;j++){
- if( A[i][j]<0){summa+=A[i][i];if(A[i][i]>max){max=A[i][i];}}
- }
- }
- for(i=0;i<n;i++){
- for(j=0;j<n;j++){
- cout << setw(6) << A[i][j];
- }
- cout << endl;
- }
- cout << "Максимальное число = " << max << endl;
- cout << "Сумма = " << summa << endl;
- cout << endl;
- cout<<"Автотр:Димид Олександр"<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement