971-21 grux talabasi Atagullayev Xikmatulla
3- Amaliy Ish
a, b va c haqiqiy son berilgan. Agar a≥b≥c tengsizlik bajarilsa, u xolda
haqiqiy sonlarni ikkilantiring, aks xolda ularni modullari bilan almashtiring.
int a=-16; int b=-36; int c=-4; int x=0;
if (a >=b&& b>=c){
System.out.println(a*2+" "+ " "+b*2+" "+c*2);
}else {
System.out.println(Math.abs(a));
System.out.println(Math.abs(b));
System.out.println(Math.abs(c)); }
}
}
2-topshiriq
y ning qiymati x ga bog’liq ravishda yoki x2 formula, yoki 2x formula bo’yicha hisoblanadi. Tekshirilishi kerak bo’lgan shart x≥0.
#include
usingnamespacestd;
int main() {
double x, y;
cout<<"x=";
cin>>x;
if (x >= 0) {
y = x * x;
}
else {
y = 2 * x;
}
cout<<"y="<}
Do'stlaringiz bilan baham: |