关于一个java证明的题目
提示: 作者被禁止或删除 内容自动屏蔽
public class Zhengming { public static void main(String args[]) { int x=20,y=41;//给xy赋初值 boolean zhengming=true; if(x%2==0 && y%2==0) zhengming=true; else zhengming=false; System.out.println("x=(x/y)*y+x%y is "+zhengming); } }
import java.util.*; public class Test { public static void main(String[] args) { int x, y; Random rand = new Random(); boolean operator = rand.nextInt(100)%2 == 0; if(operator) x = rand.nextInt(100); else x = -rand.nextInt(100); operator = rand.nextInt(100)%2 == 0; if(operator) y = rand.nextInt(100); else y = -rand.nextInt(100); System.out.println("x = " + x + " y = "+ y); if(y != 0 && x == (x/y)*y+x%y) System.out.println("如果x和y都是整数且y != 0,则x=(x/y)*y+x%y成立"); else System.out.println("如果x和y不都是整数或y == 0,则x=(x/y)*y+x%y不成立"); } }