nynw.net
当前位置:首页 >> jAvA编程怎么完成任意输入一个正整数,反序输出每一位? >>

jAvA编程怎么完成任意输入一个正整数,反序输出每一位?

public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("输入任意正整数:"); StringBuffer sb = new StringBuffer(input.next()); sb.reverse(); System.out.print("逆序为:"); System.out.pri...

public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("输入任意正整数:"); StringBuffer sb = new StringBuffer(input.next()); sb.reverse(); System.out.print("逆序为:"); System.out.pri...

import java.util.Scanner; public class TestReverse { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int read =sc.nextInt(); StringBuilder sb = new StringBuilder(String.valueOf(read)); System.out.p...

Scanner s = new Scanner(System.in);int in = s.nextInt();String inStr = in+"";for(int i=0;i

int i = 12343465; int m = 0; while (i != 0) { m =i%10; System.out.print(m); i = i/10; }

import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException{ Scanner scan = new Scanner(System.in); System.out.println("输入一个整数:"); int num = scan.nextInt(); char[] numChar = In...

public class HelloWorld { public static void main(String[] args) { System.out.println("请输入一个正整数n"); Scanner input = new Scanner(System.in); int n = input.nextInt(); for (int i = 2; i

package test1; import java.util.Scanner; public class Test6 { public static void main(String[] args) { Scanner input = new Scanner( System.in ); System.out.println("请输入一个数字:"); String str = input.next(); int result = 0;...

package test;import java.util.Scanner;public class Express {public static void main(String[] args) {System.out.println("请输入n的值");Scanner scan=new Scanner(System.in);int n=scan.nextInt();System.out.print("输出的结果是:");S...

import java.util.*; public class Su { public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.println("请输入一个数:"); int a = input.nextInt(); boolean isF = true; for(int i=2;i

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