当前位置:网站首页>C language to find the greatest common divisor and the least common multiple of two numbers
C language to find the greatest common divisor and the least common multiple of two numbers
2022-07-21 18:23:00 【p29949】
division Also known as Euclidean algorithm , Is a way to find the greatest common divisor . Its concrete method is : Divide the larger number by the smaller number , And then the remainder that appears ( The first remainder ) Remove divisor , And then the remainder that appears ( Second remainder ) Remove the first remainder , So again and again , Until the end, the remainder is 0 until . If you want to find the greatest common divisor of two numbers , So the final divisor is the greatest common divisor of these two numbers .
Method for finding maximum common divisor : division
Method of finding the least common divisor :(a x b)÷ greatest common divisor
#include <stdio.h>
int main()
{
int a,b;
int c = 0;
scanf("%a %b",&a,&b);
while (c = a % b)
{
a = b;
b = c;
}
printf("%d Is the greatest common divisor ", b);
return 0;
}
边栏推荐
- NFS FTP PXE
- 19c搭建dg最后报错ORA-01275: Operation RENAME is not allowed if standby file management is automatic.
- 八. 实战——sql与动态sql
- Don't know how to learn MySQL? It's enough to finish the 50 questions of Niuke (Chapter 10)
- 微信数据库句柄获取不全
- 不知道 MySQL 咋学?刷完牛客这 50 道题就够了!(第七篇)
- pytorch-California House Prices
- Les enregistrements d'une période de temps sont interrogés dans la base de données Oracle. S'il n'y a pas d'enregistrements d'un jour donné, les enregistrements du dernier jour seront remplis. Comment
- VII Practice -- some methods of common tools
- Appium automated testing
猜你喜欢
Tiktok system | huge arithmetic interface signature analysis and decryption
Resume: smart cockpit series article 3 - the touch of five interactive technologies behind it
Don't know how to learn MySQL? It's enough to finish the 50 questions of Niuke! (Part IX)
使用zdog实现瞭望灯塔动画js特效
物体识别桌的应用都具备哪些功能
Flat design of login and registration pages
npm 设置下载源
Image and video restoration and super score - use of real esrgan project (I) | machine learning
数据库表设计(二):索引规范和SQL语句规范
Mysql事务日志
随机推荐
The network cannot be found in the network icon in the lower right corner of the win10 desktop
Network Security Learning (Qianfeng network security notes) 3 -- batch preparation
iNFTnews | 元宇宙浪潮下,企业正通过AR和VR技术改善客户体验
六.实战——Excel表格的导入和导出
不知道 MySQL 咋学?刷完牛客这 50 道题就够了(第十篇)
CentOS7安装mysql兼容性问题
CAD browsing mode and drawing mode, how CAD prints hundreds of drawings at one time
复盘:智能座舱系列文六- 它的3种交互方式之显式交互(语音以及显示)
UneXt 基于MLP的快速医学图像分割网络
VII Practice -- some methods of common tools
I Common bug -- the project tag of POM file is red
[wechat applet] component use and attribute reference
创意分页样式svg动画js特效
Okaleido tiger NFT即将登录Binance NFT平台,后市持续看好
WEB3.0+DAO大势所趋,SAFE开创新世界
onmousemove=alert(1) style='width
Clwy permission management (VI) -- permission implementation
[C] Language dynamic memory management
Under the wave of infotnews | meta universe, enterprises are improving customer experience through AR and VR technologies
What functions does the application of object recognition table have