Java期末考试试卷.pdf
《Java期末考试试卷.pdf》由会员分享,可在线阅读,更多相关《Java期末考试试卷.pdf(5页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、Java考试一:求两个整数的最大公约数【源代码】import java.util.Scanner; public class text52 public static void main(String args) Scanner sca=new Scanner(System.in); System.out .println(Please enter the first integer: ); int x=sca.nextInt(); System.out .println(Please enter the second integer: ); int y=sca.nextInt(); Syst
2、em.out .println(highest common divisor is +gcd(x,y); public static int gcd(int x,int y) if(xy) int t=x; x=y; y=t; while (x!=0) int temp=y% x; return temp ; 定义一个方法求两个正整数的最大公约数【源代码】import java.util.Scanner; public class demo01 public static void main(String args) Scanner sc=new Scanner(System.in); Sys
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Java 期末考试 试卷
限制150内