tnfh.net
当前位置:首页 >> 如何用JAVA编程从键盘输入10个整数存入整型数组中... >>

如何用JAVA编程从键盘输入10个整数存入整型数组中...

import java.util.Scanner; public class test1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a[] = new int [10]; for(int i=0;i=0;j-- ){ System.out.print(a[j]+" "); } } } 这个应该是你要的吧

很高兴回答你的问题,下边是根据你的需求写的一段代码: public static void main(String[] args) { int[] arr = new int[10]; int count = 0; Scanner scan = new Scanner(System.in); while(count

import java.util.Scanner;public class Array {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int [] a = new int[10];int count = 0;System.out.println("请输入10个整数");while (true) {if(scanner.ha...

import java.util.Scanner; public class test1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a[] = new int [10]; for(int i=0;i=0;j-- ){ System.out.print(a[j]+" "); } } } 这个应该是你要的吧

完整的代码如下: public class Demo01 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int[] a = new int[10];int i = 0;// 输入10个整数while (true) {a[i] = sc.nextInt();i++;if (i == 10) {break;}}// 冒...

这年头分不好拿啊,你看看我这个是自己写的不? import java.util.Scanner; public class test { public static void main(String[] args) { Scanner s = new Scanner(System.in); int [] a = new int[10]; int min, max; min = max = 0; for(in...

利用Scanner循环输入10个数,在for循环中把每次输入的数字求和。代码如下: public class Test8 {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int sum = 0;for (int i = 0; i < 10; i++) {System.out.pr...

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = 10; int[] b = new int[a]; int i=0; int c = 0; while(ib[i])?b[i]:c; }else{ c=b[i]; } i++; } for(...

package Test; import java.util.Scanner; public class test { public static void main(String[] args) { Scanner sca = new Scanner(System.in); int[] ints = new int[10]; System.out.println("请输入10个数字"); for (int i = 0; i < 10; ...

private static void p5 () { int[] arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 19 }; int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for ( int i = 0; i < arr.length; i++ ) { int ai = arr[i]; if (ai > max) { max = ai; } if (ai <...

网站首页 | 网站地图
All rights reserved Powered by www.tnfh.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com