Àý7£º°Ñ100¡«200Ö®¼ä²»Äܱ»3Õû³ýµÄÊýÊä³ö£»²¢¿ØÖÆÒ»ÐÐÊä³ö10¸öÊý¾Ý¡£main()
{ int n, c=0;printf(¡°\\n¡±);
for(n=100; n<=200; n++){ if(n%3==0) continue;printf(¡°%d¡±, n); c++;
printf(¡°%s¡±, c==0? ¡±\\n¡± : ¡±???¡±);}}
Àý8£ºÊäÈëÁ½¸öÕýÕûÊýmºÍn£¬ÇóÆä×î´ó¹«Ô¼ÊýºÍ×îС¹«±¶Êý¡£Ëã·¨1£º(Çî¾Ù·¨)
1)ÕÒ³öm¡¢nÖеĽÏСÕß?t;
×î´ó¹«Ô¼Êý¿Ï¶¨ÔÚt¡¢t-1¡¢t-2¡¢¡1Ö®¼ä£»2) ²âÊÔm%iºÍn%iÊÇ·ñͬʱΪ0 £»³ýÊýiÒÀ´ÎÈ¡t¡¢t-1¡¢t-2 ¡ 1 £»
²âÊÔÌõ¼þ³ÉÁ¢Ê±µÄiÖµ¼´Îª×î´ó¹«Ô¼Êý£»3) ×îС¹«±¶Êý£ºm¡Án/×î´ó¹«Ô¼Êý£»
main( )
{ int m, n, t, i;
printf(¡°Enter m,n:¡±);
scanf(¡°%d,%d¡±, &m, &n);t=m
if (m%i==0&&n%i==0) break;
printf(¡°GCD=%d,SCM=%d\\n¡±, i, m*n/i);}
18,12¨L17,3¨LGCD=6,SCM=36 GCD=1,SCM=51
Ëã·¨2£º(շתÏà³ý·¨)main( )
{ int a, b, m, n, r, t;printf(¡°Enter a, b:¡±);
scanf(¡°%d,%d¡±, &a, &b);m=a, n=b; /*²úÉúa¡¢b¸±±¾*/if(m { m=n; n=r; r=m%n; }printf(¡°GCD=%d,SCM=%d¡±, n, a*b/n); } ÊäÈëa¡¢ba ?m, b ?n m>n?T F?r!=0? m?n Çóm%n ?r n ?mr ?nm%n ?r Êä³ön¡¢a*b/n