13 Hamdamova Gulira’noxon 13


Download 53.41 Kb.
Sana25.10.2023
Hajmi53.41 Kb.
#1719996
Bog'liq
Guliran0 mustaqil ish


  1. Mustaqil ish

13

Hamdamova

Gulira’noxon

13

1 –topshiriq. 1 –jadvalning 2-ustunida berilgan funksiyaning 4-ustunda berilgan kirish qiymatlardagiqiymatini hisoblash va natijani monitorga chop etuvchi dastur tuzing.


if, if else operatorlariga doir topshiriqlar

Dastur kodi :


#include


#include
using namespace std;

int main()


{
float x;
cout<<"x= ";
cin>>x;
float Y;
if (x>0) {
Y = sin(2*x)*sin(2*x) - pow(cos(x),2);
}
else {
Y = 1./(x*x-sqrt(x));
}
cout<<"Natija : "<

return 0;


}

Natijasi :








2 –topshiriq. 2 –jadvalning 2-ustunida berilgan masalani shartini bajaruvchi dastur tuzing.

#include


#include
using namespace std;

int main()


{
float x;
cout<<"x= ";
cin>>x;
float Y = (exp(x)+exp(-x))/2.0;
float Y1 = 1+abs(x);
float Y2 = pow(1+x*x,x);
cout<<"Tartiblanmagan xolati \n"<cout <<"Tartiblangan holati "<if(Y>=Y1 && Y1>=Y2){
cout<}
else if (Y>= Y2 && Y2 >= Y1){
cout<}
else if (Y1>= Y && Y >= Y2){
cout<}
else if (Y1>= Y2 && Y2 >= Y){
cout<}
else if (Y2>= Y && Y >= Y1){
cout<}
else if (Y2>=Y1 && Y1 >= Y){
cout<}

return 0;


}



3 –topshiriq. switch case tanlash operatoriga doir topshiriqlar
switch case tanlash operatoridan foydalanib, o’zgaruvchilarning barcha qiymatlari uchun funkstiyani hisoblash dasturini tuzing.


Case13. Teng yonli uchburchakning elementlari quyidagi tartibda nomerlangan: 1-katet a, 2-gipotenuza , 3-gipotenuzaga tushirilgan balandlik 4-yuzasi Shu elementlardan bittasi berilgan qolganlarini topuvchi dastur tuzilsin.
#include
#include
using namespace std;

int main()


{
float a;
int n;
cout<<"1. katet a\n2. gipatenuza\n3. balandlik\n4. Yuza\n";
cin>>n;
switch (n){
case 1 :{
cout<<"Katetni kiriting : ";
cin>>a;
float c= sqrt(2)*a;
cout<<"Gipatenuza : "<cout<<"Balandlik : "<< c/2<cout<<"Yuza : "<< c*c/2/2<break;
}
case 2 :{
float c;
cout<<"Gipatenuzani kiriting : ";
cin>>c;
float a= a/sqrt(2);
cout<<"Katet : "<cout<<"Balandlik : "<< c/2<cout<<"Yuza : "<< c*c/2/2<break;
}
case 3 : {
float h;
cout<<"Balandlik kiriting : ";
cin>>h;
float a= sqrt(2)*h;
cout<<"Gipatenuza : "<<2*h<cout<<"Katet : "<< a<cout<<"Yuza : "<< h*2*h/2<break;
}
case 4:{
float s;
cout<<"Yuza kiriting : ";
cin>>s;
float c= sqrt(s)*2;
cout<<"Gipatenuza : "<cout<<"Balandlik : "<< c/2<cout<<"Katet : "<< c/sqrt(2)<break;
}
}
}



Download 53.41 Kb.

Do'stlaringiz bilan baham:




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