fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a,b,c,d,e;
  5. scanf(" %d",&a);
  6. printf("一つ目の正の整数: %d\n",a);
  7. scanf(" %d",&b);
  8. printf("二つ目の正の整数: %d\n",b);
  9. if((a<=0)||(b<=0))
  10. {
  11. printf("正ではありません。");
  12. }
  13. c=a*b;
  14. if(a<b)
  15. {
  16. d=a;
  17. a=b;
  18. b=d;
  19. }
  20. e=a%b;
  21. while(e!=0)
  22. {
  23. a=b;
  24. b=e;
  25. e=a%b;
  26. }
  27. printf("最小公倍数は%dです。\n",c/b);
  28.  
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 4404KB
stdin
3
5
stdout
一つ目の正の整数: 3
二つ目の正の整数: 5
最小公倍数は15です。