using namespace std;
int main()
{
float x, y; cout<<"x="; cin>>x;
if(x>0)
{
y=pow(sin(2*x), 2)-pow(cos(x), 2);
} else if(x<=0.3)
{
y=1./(pow(x, 2)-sqrt(x));
} else cout<<"Yechimi mavjud emas"<
cout<<"Y="<
}
X=0.5 qiymat
X=0.7 qiymat
№2.
Berilgan x uchun quyidagi ifodalarning qiymatlari o’sish tartibida chop etilsin. Ifoda:
1+|x| va (1+x2)x.
#include
#include
using namespace std;
int main()
{
float x, y, z;
cout<<"x="; cin>>x;
y=1+fabs(x);
z=pow((1+pow(x, 2)), x);
if(y
else cout<<"y="<
return 0;
}
№3. Tanlash operatori:
Teng yonli uchburchakning elementlari quyidagi tartibda nomerlangan: 1-katet a, 2-gipotenuza c=√2a, 3-gipotenuzaga tushirilgan balandlik h=c/2, 4-yuzasi S=. Shu elementlardanbittasi berilgan qolganlarini topuvchi dastur tuzilsin.
// tanlash operatori
#include
#include
#include
using namespace std;
int main()
{
int a, h, c; float S;
char x;
cout<<"Teng yonli to'g'ri burchakli uchburchak"<>"<>"<>"<>"<
cout<<"Yuqoridagi qaysi paramtr orqali ifodalamoqchisiz?"<>x; switch(x)
{
case 'a': cout<<"Katet orqali ifodalaymiz"<>a;
cout<<"Gipotenuza c="<
cout<<"c="; cin>>c;;
cout<<"Katet a="< break;
case 'h': cout<<"Balandlik orqali ifodasi"<>h;
cout<<"katet a="< break;
case 'S': cout<<"Yuza orqali ifodalash"<>S;
cout<<"Katet a="<
}
return 0;
}