Đăng nhập để hỏi chi tiết


Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
#Bài 1:
m,n=map(int,input().split())
print(max(m,n))
#Bài 2:
a,b=map(int,input().split())
print(-b/a)
#Bài 3:
x,y,z=map(int,input().split())
if x<y:
print(x+x*z+y*y-2*y*y)
else:
print(x*x+y*y-z**3)Hãy giúp mọi người biết câu trả lời này thế nào?
Bài `1` :
#include <iostream>
using namespace std;
int main() {
int m, n;
cout << "Nhap m, n: ";
cin >> m >> n;
int maxVal = (m > n) ? m : n;
cout << "Gia tri lon nhat = " << maxVal;
return 0;
}
Bài `2` :
#include <iostream>
using namespace std;
int main() {
float a, b;
cout << "Nhap a, b: ";
cin >> a >> b;
if (a == 0) {
if (b == 0) cout << "Phuong trinh vo so nghiem";
else cout << "Phuong trinh vo nghiem";
} else {
float x = -b / a;
cout << "Nghiem x = " << x;
}
return 0;
}
Bài `3` :
#include <iostream>
using namespace std;
int main() {
float x, y, z, s;
cout << "Nhap x, y, z: ";
cin >> x >> y >> z;
if (x > y) {
s = x*x + y*y - z;
}
else if (x < y) {
s = x + x*z*z*y*y - z*y*y;
}
else {
cout << "x = y nen khong co cong thuc tinh S!";
return 0;
}
cout << "Gia tri s = " << s;
return 0;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin