software_testing_work3_question1
package com.Phantom; import java.io.IOException;
import java.util.Scanner; public class Work3_1 {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
Scanner in=new Scanner(System.in);
System.out.println("请输入两个数字");
int num1=in.nextInt();
int num2=in.nextInt();
System.out.println("最大公约数为>>>"+operation(num1,num2));
}
public static int operation(int a,int b) throws IOException {
int num=0;
for(int i=1; i<=a; i++){
if(b%i==0&&a%i==0){
num=i;
}
}
return num;
}
}
运行结果:

findBugs:


software_testing_work3_question1的更多相关文章
随机推荐
- redis + spring 集成
1.pom <modelVersion>4.0.0</modelVersion> <groupId>com.x.redis</groupId> < ...
- json转实体类
VS快速生成JSON数据格式对应的实体 Json生成类在线生成工具 http://tool.sufeinet.com/Creater/JsonClassGenerator.aspx http://js ...
- web前端页面项目经验总结
项目时间:2016年4月5日--4月9日项目名称:阿七果子园web前端页面项目内容: 1.HTML5+CSS+JavaScript(banner+timer)+JQuery(small_bann ...
- OptionsMenu
菜单是用户界面中最常见的元素之一,使用非常频繁,在Android中,菜单被分为如下三种,选项菜单(OptionsMenu).上下文菜单(ContextMenu)和子菜单(SubMenu),今天这讲是O ...
- 基于PNotify的消息提示Demo(轮询)
需求:有些任务需要定时更新,获取最新的消息,这样就需要定时轮询,再者需要一种友好的提示. 以下就是使用PNotify插件的消息提示: 1.HTML代码 <!DOCTYPE html> &l ...
- 关于MVC4项目从32位机移到64位机编译报错解决方案
早上写了个MVC WEBAPI的demo 机子环境是:XP SP3+ VS2010 + ASP.NET MVC4 然后晚上拿回笔记本进行编译运行,结果报错如下: “/”应用程序中的服务器错误. 分析器 ...
- [css3]跑马灯
<div class="marquee"> <div> <p>纯CSS3生成的走马灯效果</p> <p>纯CSS3生成的 ...
- bzoj 3611: [Heoi2014]大工程
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #d ...
- APP标配控制器:UINavigationController
导航控制器UINavigationController简介: 只要看到控制器界面上部有一个条就是导航控制器UINavigationController 导航控制器最上面有一个条是导航条高度44,Y值是 ...
- reds Virtual Memory
Virtual Memory technical specification This document details the internals of the Redis Virtual Memo ...