全文预览

c语言答案

上传者:梦&殇 |  格式:pdf  |  页数:47 |  大小:3756KB

文档介绍
repeat!"#$:EvaluationWarning:ThedocumentwascreatedwithSpire.PDFfor.NET.\r?ˆm‚n,?M‰ŠP€U1‚€ƒ1,J\r??M_`%abc&ef\r?%\r3(repeat=3)\r37(m=3,n=7)\r244(m=24,n=4)\r2418(m=24,n=18)\r?M%\r21istheleastcommonmultipleof3and7,1isthegreatest\rcommondivisorof3and7.\r24istheleastcommonmultipleof24and4,4isthegreatest\rcommondivisorof24and4.\r72istheleastcommonmultipleof24and18,6isthegreatest\rcommondivisorof24and18.\rttinclude<stdio.h>\rintmain(void)\r{\rintgcd,1cm,m,n,c;\rintrepeat,ri;\rscanf("%d”,&repeat);\rfor(ri=1;ri<=repeat;ri++)\r{\rscanf("%d",&m);\rscanf&n);\rif(m<=n)c=m;/*‹mU,€ƒŒP1,Ždm*/\relsec=n;\rfor(lcm=l;;lcm++){\rif(lcm%m==0&&lcm%n==0)\rbreak;EvaluationWarning:ThedocumentwascreatedwithSpire.PDFfor.NET.\rfor(gcd=c;;gcd){\rif(m%gcd==0&&n%gcd==0)\rbreak;\rprintf('%distheleastcommonmulti

收藏

分享

举报
下载此文档