习题程序代码.docVIP

  • 2
  • 0
  • 约4.17千字
  • 约 6页
  • 2023-11-28 发布于四川
  • 举报
第五讲 成员变量与方法 习 题 Page 57:第1题 —— Page 57:第1题 —— 第7题 public class SushuMethod{ void suShu(int x){ boolean a=true; int n; n=x; for(int i=2;in;i++){ if(n%i==0){ a=false; break; } } if(a!=false){ System.out.println(True); }else{ System.out.println(False); } } public static void main(String args[]){ int x=java.lang.Integer.parseInt(args[0]); MethodGather aa=new MethodGather(); aa.suShu(x); } } 写两个函数,分别求两个数的最大公约数和最小公倍数。 public class Max_Min{ void a(int x

文档评论(0)

1亿VIP精品文档

相关文档