SubhanXd
Centipat
- Katılım
- 5 Kasım 2022
- Mesajlar
- 161
Selamlar.Yapmam gereken görev :
Given two real numbers X and Y, apply the specified transformations based on the conditions: If X and Y are negative, replace each value with its absolute value. If only one of them is negative, increase both values by 0.5. If both values are non-negative and do not belong to the range [0.5, 2.0], reduce both values by 10 times. Otherwise, leave the numbers unchanged.
Yazdığım kod:
int main(){
double x , y ;
cin >> x ;
cin >> y ;
if (x < 0 and y < 0) {
cout << abs(x) << " " << abs << endl ;
} else if ((x || y < 0) || (x || y > 0)) {
cout << x + 0.5 << y+0.5 << endl ;
}else if ((x > 0 and y > 0) and ( x >2 and y > 2 )) {
cout << x / 10 << " " << y / 10 << endl ;
} else {
cout << x << " " << y << endl ;
}
}
Given two real numbers X and Y, apply the specified transformations based on the conditions: If X and Y are negative, replace each value with its absolute value. If only one of them is negative, increase both values by 0.5. If both values are non-negative and do not belong to the range [0.5, 2.0], reduce both values by 10 times. Otherwise, leave the numbers unchanged.
Yazdığım kod:
int main(){
double x , y ;
cin >> x ;
cin >> y ;
if (x < 0 and y < 0) {
cout << abs(x) << " " << abs << endl ;
} else if ((x || y < 0) || (x || y > 0)) {
cout << x + 0.5 << y+0.5 << endl ;
}else if ((x > 0 and y > 0) and ( x >2 and y > 2 )) {
cout << x / 10 << " " << y / 10 << endl ;
} else {
cout << x << " " << y << endl ;
}
}
Son düzenleyen: Moderatör: