develop a program to calculater the least common multiple of two numbers input from the keyboard

develop a program to calculater the least common multiple of two numbers input from the keyboard

题目
develop a program to calculater the least common multiple of two numbers input from the keyboard
答案
#include<stdio.h>  
void main()   //辗转相除法求最大公约数,然后最小公倍数=a*b/最大公倍数 
{   
   int m, n, a, b, t, c;  
   printf("Input two integer numbers: ");  
   scanf("%d%d", &a, &b);  
   m=a;   n=b;  
   while(b!=0)  /* 余数不为0,继续相除,直到余数为0 */   
   { c=a%b; 
   a=b;  
   b=c;}  
   

   printf("The least common multiple:%d ", m*n/a);  
}
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点

超级试练试题库

© 2017-2019 超级试练试题库,All Rights Reserved.