1import java.util.Scanner;public class test1 { private static Scanner input= new Scanner(System.in); public static void main(String[] args){ long num; do{ System.out.print("\nInput your num: "); num=input.nextLong(); }while(num<和码10000||num>99999); num=num/100; num*=100; System.out.println("\nThis is num: "+num); }}2.import java.util.Scanner;public class 纯山test2 { private static Scanner input= new Scanner(System.in); public static void main(String[] args){ long num; do{ System.out.print("\nInput your num: "); num=input.nextLong(); }while(num<0||num>1000); int sum=0; while(num>0){ sum+=num%10; num/=10; } System.out.println("\nThis is sum: "唤裤哪+sum); }}
相关文章
-
java中怎么数组初始化?
2023-12-07 10:03 阅读(595) -
java 没学过但有兴趣请问它能编译出EXE吗?
2023-12-03 11:39 阅读(563) -
java中charAt方法对String字符串的使用
2023-10-26 02:56 阅读(620)
2 javaee任务管理系统代码
619 阅读
3 Java中的boolean怎么用?
657 阅读
4 java安装错误代码1603
587 阅读
5 javascript:void(0)是什么意思
586 阅读