您所在的当前位置: 计算机等级考试题库   >  
BASIC题库  
  >   [填空题] 下面的程序是找出两个正整数a和b,使得a<b、a+ b=99、a和b的最大公约数是3的倍数,并统计满足条件数对的个数。Option ExplicitDim a As Integer, b As Integer, n As Integer, c As IntegerPrivate Function Gcd (ByVal a As Integer, Byval b As Integer) As Integer do c=a Mod b: a=b=c Loop 【13】 Gcd=aEnd FunctionPrivate Sub form_ Click() n=0 for a= 1 To 49 b= 【14】 c= Gcd (a, b) if c Mod 3= 0 then 【15】 Print a, b, c End if Next a Print nEnd Sub
问题:
发布时间:2022-07-01

[填空题] 下面的程序是找出两个正整数a和b,使得a<b、a+ b=99、a和b的最大公约数是3的倍数,并统计满足条件数对的个数。Option ExplicitDim a As Integer, b As Integer, n As Integer, c As IntegerPrivate Function Gcd (ByVal a As Integer, Byval b As Integer) As Integer do c=a Mod b: a=b=c Loop 【13】 Gcd=aEnd FunctionPrivate Sub form_ Click() n=0 for a= 1 To 49 b= 【14】 c= Gcd (a, b) if c Mod 3= 0 then 【15】 Print a, b, c End if Next a Print nEnd Sub

可能感兴趣的题目: