# Mavzu: Takrorlanish operatorlari

 Sana 15.07.2021 Hajmi 9.57 Kb.

TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI

Dasturlash 1 fanidan laboratoriya mashg’uloti

### Mavzu: Takrorlanish operatorlari

713-20 Guruh talabasi Yusupov Fayzullo

Varyant-2

1,2.

Masalaning berilishi: Berigan 10 ta natural sonlarning eng katta umumiy bo’luvchisini toping.

Natija:

#include

using namespace std;

int ekub (int, int);

int main () {

int d, e, f, g, h, m, n, k, p;

int c[10];

int a, b, i;

for (int i=1; i<=10; i++){

cout<< i<<"- sonni kiriting = ";

cin>>c[i];}

d=ekub(c[1],c[2]);

e=ekub(c[4],c[3]);

f=ekub(c[5],c[6]);

g=ekub(c[8],c[7]);

h=ekub(c[10],c[9]);

m=ekub(d,e);

m=ekub(f,g);

k=ekub(m,n);

p=ekub(p,k);

cout<<"EKUB= "<< p;

return 0; }

int ekub(int a, int b){while (a !=b) a>b?a-=b:b-=a;return a ; }

2.2

Masalaning berilishi: Berigan natural n va m soni uchun t=

#include

using namespace std;

int main()

{ int pi=1,i,j,n,m,sum=0;

cout << "n="; cin>>n;

cout << "m="; cin>>m;

for(i=3;i<=n;i++)

{sum=0;

for(j=2;j<=m;j++)

{sum=sum+2*j+j*j; }

pi= pi*sum; }

cout <
return 0;

}

3.2

Masalaning berilishi : Kiritilgan butun sonlar ketma-ketligi ichidan (0-ketma-ketlikning oxiri),musbatlar orasida eng kichik va manfiy orasida eng kattasi o’rtasidagi farqini toping.