import java.util.Scanner;
public class GreatesCommonDivisor {
public static void main(String[] args) {
Scanner input = new Scanner(System.in); System.out.print("Enter first integer: ");
int n1 = input.nextInt();
System.out.print("Enter second integer: ");
int n2 = input.nextInt(); int gcd = ;
int k = ;
while (k <= n1 && k <= n2) {
if (n1 % k == && n2 % k == )
gcd = k;
k++;
} System.out.println("The greatest common divisor for " + n1 + " and " + n2 + " is " + gcd);
}
}

最新文章

  1. 分布式系统理论进阶 - Paxos
  2. ajax返回json数据,对其中日期的解析
  3. 项目安排(离散化+DP)
  4. CodeSoft随笔 批量连续打印,变量打印,codesoft条码
  5. 记一次小团队Git实践(中)
  6. 浏览器查看cookie
  7. CentOS 7 firewalld使用简介
  8. Java中类名与文件名的关系
  9. ios-NSStringFromCGRect直接输出控件的frame
  10. ajax success 和complete 的区别
  11. IOS 使用新浪微博SDK
  12. 恢复sudo的权限的命令
  13. linux下出现java.net.UnknownHostException
  14. Laravel创建Model
  15. js 正则练习之语法高亮
  16. C++inserter
  17. Android源码博文集锦1
  18. mybatis 详解(十一)------ mybatis和spring整合
  19. git for windows上传项目到github
  20. 修改windows7中文件的权限

热门文章

  1. Beats:如何创建一个定制的Elastic Beat
  2. Leetcode_395. Longest Substring with At Least K Repeating Characters_[Devide and Conquer]
  3. LintCode之最长单词
  4. mybatis缓存机制(转)
  5. Spring 注解配置 WebApplicationContext
  6. mysqldump - 备份 MySQL 数据库
  7. HTML5移动应用——小心代码注入风险
  8. 20190825 On Java8 第十二章 集合
  9. 函数式编程filter和map的区别
  10. PHP开发环境搭建及开发工具