从键盘上输入任意一个数x判定该数是否满足x4若满足则输出YES否则输出NO
Python代码:
x = float(input())
if abs(x) > 4:
print("YES")
else:
print("NO")
Java代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double x = scanner.nextDouble();
if (Math.abs(x) > 4) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
C++代码:
#include <iostream>
#include <cmath>
using namespace std;
int main() {
double x;
cin >> x;
if (abs(x) > 4) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
原文地址: https://www.cveoy.top/t/topic/b7cZ 著作权归作者所有。请勿转载和采集!