tnfh.net
当前位置:首页 >> JAVA问题:输入10个整数,逆序输出他们? >>

JAVA问题:输入10个整数,逆序输出他们?

import java.util.Scanner;public class Demo001 {public static void main(String[] args) {System.out.println("请输入10个数,以空格隔开:");Scanner scaner = new Scanner(System.in);String strInput = scaner.nextLine();String a[] = st...

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.io.*; import java.util.*; public class A { public static void main(String[] args) throws NumberFormatException, IOException { int[] num=new int[10]; BufferedReader br=new BufferedReader(new InputStreamReader(System....

public static void main(String []args){ Scanner in=new Scanner(System.in); int n=in.nextInt(); while(n!=0){ System.out.print(n%10); n/=10; }}

lin1=[]for i in range(1,11): lin1.append(i)lin1.reverse()print(lin1)

indexOfMain = i 吗????? 你这样不是数组内元素啊

思路:定义整型数组a,for循环键盘输入赋值,接着从下标0到9顺序输出,再从下标9到0逆序输出。 参考代码: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #include int main() { int a[10],i; for(i=0;i

其实就这么简单,有注释。也没有复杂的语句。 import java.util.Scanner;import java.lang.System;public class fds {public static void main(String[] args) {Scanner sc = new Scanner(System.in);String inputStr = sc.next(); // 获取控制...

package baidu.a20111024; import java.util.Arrays; public class Smalltobig { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int [] num = {2,1,5,4,6,3,7,9,8,0,}; Arrays.sort(num);...

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