import java.util.Scanner; //抄别人的代码改成java public class Main{ public static int gcd(int a,int b){ int sum=0; while(b!=0){ sum=a%b; a=b; b=sum; } return a; } public static int lcm(int a,int b){ return a*b/gcd(a,b); } public static void main(String[] age){ Scanner in=new Scanner(System.in); int a=in.nextInt(); int b=in.nextInt(); System.out.println(gcd(a,b)+" "+lcm(a,b)); } }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:896 |
C语言训练-求函数值 (C语言代码)浏览:573 |
WU-蓝桥杯算法提高VIP-交换Easy (C++代码)浏览:1107 |
简单的a+b (C语言代码)浏览:573 |
printf基础练习2 (C语言代码)浏览:617 |
简单的a+b (C语言代码)浏览:478 |
震宇大神的杀毒软件 (C语言代码)浏览:1079 |
剪刀石头布 (C语言代码)浏览:1432 |
陶陶摘苹果2 (C语言代码)浏览:595 |
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:582 |