Tekshirdi: Mirzayeva Gulmera


Download 293.05 Kb.
Sana18.02.2023
Hajmi293.05 Kb.
#1212765
Bog'liq
Mexridingaga


MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI
TELEKOMMUNIKATSIYALAR FAKULTETI


Dasturlash 1 fani


2-mustaqil amaliyot ish

Bajardi: 414-22-guruh 1-bosqich talabasi Zaxriddinov Mexriddin


Tekshirdi: Mirzayeva Gulmera.



  1. A) Berilgan sonni kubini topadigan funksiya yarating. Ushbu funksiya yordamida a,b,c,d,sonlarni kubini hisoblang.

#include
#include
using namespace std;
float daraja (float a, float b, float c, float d)
{
float y;
y=pow(a,3);
y=pow(b,3);
y=pow(c,3);
y=pow(d,3);
return y;
}
int main()
{
float a,b,c,d,y;
cout<<"a ni kiriting"<>a;
cout<<"b ni kiriting"<>b;
cout<<"c ni kiriting"<>c;
cout<<"d ni kiriting"<>d;
cout<<"sonning darajasi"< main();
}

2) Berilgan ikkita sonni “do’st son”larga tekshiradigan funksiya yordamida a va a1, b va b1, c va c1 sonlarni o’zaro do’stlikka tekshiring. Izoh: do’st sonlar deb birinchi sonning bo’luvchilari yig’indisi ikkinchi sonni , ikkinchi sonni bo’luvchilari soni birinchi sonni tashkil qilgan sonlar juftiga aytiladi.


#include
#include
using namespace std;
void friendNumber (int a, int b) {
int s1=0, s2=0;
for ( int i=1; i if(a%i==0) {
s1+=i;
}
}
for(int i=1; i if(b%i==0) {
s2+=i;
}
}
if(s1==b && s2==a) {
cout<<"berilgan sonlar o'zaro do'st";
}
else {
cout<<"berilgan sonlar o'zaro do'st emas";
}
}
int main()
{

int a,b;


cout<<"a="; cin>>a;
cout<<"b="; cin>>b;
friendNumber(a,b);
return 0;
}

3.N ta elementdan tashkil topgan massiv berilgan . Bu massivning juft o’rinlarida turgan elementlari yig’indisi hisoblansin.

#include
#include
using namespace std;
int main()
{
int n,s=0;
cin>>n;
int a[n];
int k=2;
for(int i=0; i a[i]=k;
k=k+2;
}
for(int i=0; i cout< s+=a[i];
}
{
cout<<"natija"< }

4. Int *s


Berilgan s vector kattalikning indekslari quyidagilarga teng bo’lgan elementlari chop qilinsin:
a)ikkining darajalari:(1,2,4,8,16…);
b)to’liq kvadratlari:(1,4,9,16,25…);
c)fibonachchi sonlar:(1,2,3,5,8,13…);

#include


using namespace std;
int main() {
int x,n;
cout<<"n="<<"\n";
cin>>n;
int*s=new int (n);
cout<for(x=0; xcin>>s[x];
}
cout<<"Natija:";
for(x=1; x<=n; x*=2){
cout<}
cout<delete[]s;

getline(cin,s);


for(int i=0; iif(string(1,s[i])=="u"){
k++;
}
}
cout<}


Download 293.05 Kb.

Do'stlaringiz bilan baham:




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