I ___________ (mean) to call on you, but was prevented from doing so.
查看答案
程序填空题:从键盘输入一个整数,输出它的绝对值。public class AbsoluteValue{ public static void main(String[] args){Scanner scan=new Scanner(System.in);System.out.println("请输入一个整数");int num=scan.(1);int absolute=0;if(absolute>=0){absolute=(2);}else{absolute=(3);}System.out.println("绝对值为:"+absolute);}}
打印200-300之间的所有素数System.out.println("200-300之间的素数有:");for (int num = 200; num <= 300; num++){boolean isPrime =;for (int i = 2; i <= num - 1; i++){if (){isPrime =;break;}}if (isPrime){System.out.print(num + " ");}}
输入一个正整数,并做以下运算:如果为偶数,除以2;如果为奇数,乘3加1。得到的结果再按上述要求运算,直到最后的结果为1,经过多少次这样的运算才得到数1。public ____Test{public ____void main(string[] args){System.out.println("请输入一个正整数:");Scanner sc=new Scanner(System.in);int num =;int count = 0;while (num != 1){if (____){num = num / 2;}else{num=num*3+1;}____;}System.out.println("次数为:" + count);}}
输入10个数,求出最大值及最小值public class MaxNumber {public static void main(String[] args) {Scanner scanner=new Scanner(System.in);System.out.print("请输入第1个数:");double number=scanner.nextDouble();double max=1;double min=2;for(3;i<=10;i++){System.out.print("请输入第"+i+"个数:");number=scanner.nextDouble();if(4){max=number;}if(5 ){min=number;}}System.out.println("最大值为:"+max);System.out.println("最小值为:"+min);}}