import java.util.Scanner; class LogicExer { static Scanner in = new Scanner(System.in); public static void main(String args[]) { int a; int b; a = b = 20; boolean bo1 = (++a % 3 == 0) && (a++ % 7 == 0); System.out.println(a+"+"+bo1); boolean bo2 = (b++ % 3 == 0) && (++b % 7 == 0); System.out.println(b+"+"+bo2); double d1 = Math.random(); System.out.println(d1); int num = (int)(Math.random() * 101); int num0 = (int)(Math.random() * 100) + 1; int s = 4; switch (s) { case 1:{System.out.println(1);break;} case 2:{System.out.println(2);break;} case 3:{System.out.println(3);break;} case 4:{System.out.println(4);break;} default:{System.out.println(0);break;} } int score = in.nextInt(); int s0 = 0; if(score > 60) { s0 = 1; } switch(s0) { case 1: { System.out.println("合格"); break; } default: { System.out.println("不合格"); break; } } } }
import java.util.Scanner;
class LogicExer
{
static Scanner in = new Scanner(System.in);
public static void main(String args[])
{
int a;
int b;
a = b = 20;
boolean bo1 = (++a % 3 == 0) && (a++ % 7 == 0);
System.out.println(a+"+"+bo1);
boolean bo2 = (b++ % 3 == 0) && (++b % 7 == 0);
System.out.println(b+"+"+bo2);
double d1 = Math.random();
System.out.println(d1);
int num = (int)(Math.random() * 101);
int num0 = (int)(Math.random() * 100) + 1;
int s = 4;
switch (s)
{
case 1:{System.out.println(1);break;}
case 2:{System.out.println(2);break;}
case 3:{System.out.println(3);break;}
case 4:{System.out.println(4);break;}
default:{System.out.println(0);break;}
}
int score = in.nextInt();
int s0 = 0;
if(score > 60)
{
s0 = 1;
}
switch(s0)
{
case 1:
{
System.out.println("合格");
break;
}
default:
{
System.out.println("不合格");
break;
}
}
}
}文章来源地址https://www.toymoban.com/news/detail-427386.html
文章来源:https://www.toymoban.com/news/detail-427386.html
到了这里,关于JAVA输入语句与循环控制结构------JAVA入门基础教程的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!