import java.util.Scanner;
import static java.lang.StrictMath.pow;
import static java.lang.StrictMath.toIntExact;
public class java21 {
public static void main(String[] args) { //循环结构案列
int i,sum=0; //声明为整型
i=1;//初始条件
while (i<=100){
sum+=i;
i++;
}
System.out.println("sum="+sum);
//赋值运算符作用:将常量、变量或表达式的值赋给某一个变量。将运算符右边的值赋给左边的变量a+=b
//在Java中可以通过一条赋值语句对多个变量进行赋值。int a,b,c; a=b=c=100
//关系运算符 所得的值为True或Flase
//案例:如何使用boolean以及 Python和Java if else 这些区别在于 if是加冒号,java每个加{}
int ZhangScore,LiScore;
boolean IsHanger;
Scanner sc= new Scanner(System.in);
System.out.print("输入张三的成绩:");
ZhangScore=sc.nextInt();
System.out.print("输入李四的成绩:");
LiScore=sc.nextInt();
IsHanger=ZhangScore>LiScore;
System.out.println("张三的成绩比李四的成绩高吗?"+IsHanger);
if (IsHanger){
System.out.println("张三的成绩确实比李四的高"); }
else{
System.out.println("张三的成绩比李四的低");
}
//逻辑运算符 a&b 有一个true 否则为false a|b 有一个为真就是真 a^b相同为Trye 不相同为False !a 如果a是false 结果为True a&&b都为True为True ||有一个为true即true
//&和&&的区别在于 &不管左边是什么右边都会进行运算,&& 只运行左边的算式,不会运行右边的。
//|和||的区别在于 |任何一边为true都为true,||只计算左边的值