Mavzu: Takrorlanish operatorlari


Download 35.17 Kb.
Sana23.11.2020
Hajmi35.17 Kb.
#150629
Bog'liq
Dasturlash


MUHAMMAD AL- XORAZMIY NOMIDAGI

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

#include

using namespace std;

int main()

{ float i,j,n,m,t=0;

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

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

for(i=2;i

{

for(j=2;j

t+=i*i/j;}

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.

Download 35.17 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling