19、定义一个长度为10的整型数组,利用循环从键盘对其初始化。然后再输入一个整数n,在数组里面查找n,若找到则输出对应下标,若找不到则给出提醒。java
时间: 2024-03-27 13:36:47 浏览: 55
00x^5-2.00x^3+4.00x^2+1.00
Polynomial 2: 好的,这是 Java 语言的代码实现:
```java
import java.util.Scanner;
public class Main {
public static2.00x^4-3.00x^3+1.00x^2-1.00x
Sum: void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int[] arr = new int[10];
// 从键盘输入初始化数组
for (int i = 0; i < arr.length; i++) {
System.out.print("3.00x^5+2.00x^4-5.00x^3+5.00x^2-1请输入第" + (i + 1) + "个整数:");
arr[i] = scanner.nextInt();
}
System.00x
Difference: 3.00x^5-2.00x^4+1.00x^3+3.out.print("请输入要查找的整数:");
int n = scanner.nextInt();
// 在数组中查找元素n.00x^2+1.00x
Polynomial 1 value at x=2.00: 92.00
Pol
int index = -1;
for (int i = 0; i < arr.length; i++) {
if (arr[i] == n) {
index = i;
break;
}
}
// 输出结果
if (index == -ynomial 2 value at x=2.00: 14.00
Sum value at x=2.00: 186.001) {
System.out.println("在数组中未找到该元素!");
} else {
System.out.println("元素
Difference value at x=2.00: 102.00
```
阅读全文