Vazifa: Massivlar va matritsalarning xotirada tashkil etilishi



Download 29.65 Kb.
Sana26.10.2019
Hajmi29.65 Kb.
Amaliy ish №:2

Vazifa: Massivlar va matritsalarning xotirada tashkil etilishi.

#include

#include

#include

using namespace std;

int main()

{

srand(time(0));



int n,s1=0,s2=0,arif1=0,arif2=0;

int a[100][100];

cout<<"n= ";

cin>>n;

for(int i=0; i

{

for(int j=0; j

{

a[i][j]=rand()%10;

cout<

}

cout<

}

cout<<"\n";

cout<<"1-qism\n";

for(int i=0; i

{

for(int j=0; j

{

cout<

s1+=a[i][j];

}

cout<

}

cout<<"\n";

cout<<"2-qism\n";

for(int i=n/2; i

{

for(int j=0; j

{

cout<

s2+=a[i][j];

}

cout<

}

cout<<"\n";

cout<<"arif1= "<

if(s1==s2)

{

cout<<"bir biriga teng \n";



for(int i=0; i

{

for(int j=0; j

{

cout<

}

cout<

}

}

if(s1>s2)



{

cout<<"NATIJA 1-qism katta bo'lgandagi \n";

for(int i=0; i

{

for(int j=0; j

{

cout<

}

cout<

}

}

if(s2>s1)



{

cout<<"NATIJA 2-qism katta bo'lgandagi \n";

for(int i=n/2; i

{

for(int j=0; j

{

cout<

}

cout<

}

for(int i=0; i

{

for(int j=0; j

{

cout<

}

cout<

}

}

}





Do'stlaringiz bilan baham:


Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2019
ma'muriyatiga murojaat qiling

    Bosh sahifa