程序填空题:编写一个方法,计算一个整数各位数字之和。编写程序提示用户输入一个整数,然后显示这个整数所有数字的和。public class SumDigits {public static void main(String[] args) {Scanner sc=new Scanner(System.in);System.out.println("请输入一个整数:");long num=sc.nextLong();System.out.println("各位数字之和为:"+1);}public static2 sumDigits(long n){int sum=0;while(3){sum4;n 5 ;}return sum;}}
程序填空题:编写方法,按升序显示三个数。编写测试程序,提示用户输入三个整数,调用方法以升序显示它们。public class Sort {public static void main(String[] args) {Scanner scan=new Scanner(System.in);System.out.print("请输入三个整数:");int num1=scan.nextInt();int num2=scan.nextInt();int num3=scan.nextInt();System.out.printf("%d,%d,%d\n",num1,num2,num3);displaySortedNum(num1,num2,num3);}public static void displaySortedNum(int num1, int num2, int num3) {if(num1>num2){int temp=num1;num1=num2;num2=temp;}if(num2>num3){int temp=num2;num2=num3;num3=temp;}if(1){int temp=2;3 =num2;num2=temp;}System.out.printf("%d,%d,%d\n",num1,num2,num3);}}
程序填空题:编写方法,按升序显示三个数。编写测试程序,提示用户输入三个整数,调用方法以升序显示它们。public class Sort {public static void main(String[] args) {Scanner scan=new Scanner(System.in);System.out.print("请输入三个整数:");int num1=scan.nextInt();int num2=scan.nextInt();int num3=scan.nextInt();System.out.printf("%d,%d,%d\n",num1,num2,num3);displaySortedNum(num1,num2,num3);}public static void displaySortedNum(int num1, int num2, int num3) {if(num1>num2){int temp=num1;num1=num2;num2=temp;}if(num1>num3){int temp=num1;num1=num3;num3=temp;}if(1){int temp=2;=num2;num2=temp;}System.out.printf("%d,%d,%d\n",num1,num2,num3);}}
米罗的画带有强烈的宗教色彩,以画面逼真写实著称。()
A. 对
B. 错