Untitled

 avatar
user_2074942
plain_text
10 days ago
1.0 kB
4
Indexable
Never
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<thread>
#include<mutex>
#include<chrono>
#include<algorithm>
#include<cmath>  

using namespace std;

int main()
{
    srand(time(NULL)); 

    int eni, hundurluyu, random, matrix = 0;

    cout << "hundurluyu: " << endl;
    cin >> eni;

    cout << "eni: " << endl;
    cin >> hundurluyu;

    if (eni != hundurluyu)
    {
        cout << "olchuler eyni deyil" << endl;
    }

    for (int i = 0; i < eni; i++)
    {
        for (int j = 0; j < hundurluyu; j++) {

            random = rand() % 99;

            if (i==j)
            {
                matrix += random;
            }

            if (random < 10)
            {
                cout << " " << random<<" ";
            }
            else {

                cout << random << " ";
            }
        }

        cout << " " << endl;
    }

    cout << "matrix = " << matrix;

    return 0;
}
Leave a Comment