首页 > 其他 > 详细

实验3

时间:2016-04-13 02:08:10      阅读:247      评论:0      收藏:0      [点我收藏+]

第一题:

import java.util.Scanner;


public class demo {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

Scanner scanner = new Scanner(System.in);
System.out.print("请输入第一个数a:");
int a = scanner.nextInt();
System.out.print("请输入第二个数b:");
int b = scanner.nextInt();
int c=a%b;
a=b;
b=c;
if(c!=0){
a=b;
b=c;
}
else
System.out.println("a,b的最大公约数为:"+a);
}
}

 

 

第二题

语句覆盖:

路径:a-e-g  测试用例:x=4 y=-1  输出结果:x=3 y=-1 

   a-e-f        x=6 y=-1         x=7 y=-1

   a-b-c          x=3 y=2           x=3 y=3

分支覆盖:

路径:a-e-g  测试用例:x=4 y=-1  输出结果:x=3 y=-1 

   a-e-f        x=6 y=-1         x=7 y=-1

   a-b-d       x=3 y=1                     x=3 y=1技术分享

   a-b-c          x=3 y=2           x=3 y=3

实验3

原文:http://www.cnblogs.com/a13857a/p/5385135.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!