求代码

解决方案 »

  1.   

    Module Module1    Sub Main()
            Dim input(1) As Integer
            For i As Integer = 0 To 1
                input(i) = Val(Console.ReadLine())
            Next
            Dim result = Enumerable.Range(1, input.Max() - 1).
                Where(Function(n)
                          Dim r As Boolean = True
                          input.ToList().ForEach(Function(m)
                                                     If m Mod n <> 0 Then r = False
                                                 End Function)
                          Return r
                      End Function).Select(Function(n) n).Max()
            Console.WriteLine(result)
        End SubEnd Module
    24
    32
    8
      

  2.   

    Module Module1    Sub Main()
            Dim input(1) As Integer
            For i As Integer = 0 To 1
                input(i) = Val(Console.ReadLine())
            Next
            Dim result = Enumerable.Range(1, input.Max() - 1).
                Where(Function(n)
                          Dim r As Boolean = True
                          input.ToList().ForEach(Function(m)
                                                     If m Mod n <> 0 Then r = False
                                                 End Function)
                          Return r
                      End Function).Select(Function(n) n).Max()
            Console.WriteLine(result)
        End SubEnd Module
      

  3.   

    Module Module1    Sub Main()
            Dim input(1) As Integer
            For i As Integer = 0 To 1
                input(i) = Val(Console.ReadLine())
            Next
            Dim result = Enumerable.Range(1, input.Max()).
                Where(Function(n)
                          Dim r As Boolean = True
                          input.ToList().ForEach(Function(m)
                                                     If m Mod n <> 0 Then r = False
                                                 End Function)
                          Return r
                      End Function).Select(Function(n) n).Max()
            Console.WriteLine(result)
        End SubEnd Module
      

  4.   


    Public Function 最大公约数(a As Integer, b As Integer) As Integer
        Dim t As Integer
        If a < b Then t = a: a = b: b = t
        
        While b <> 0
            t = a Mod b: a = b: b = t
        Wend
        
        最大公约数 = a
    End Function
      

  5.   

    一贴一回。
    已经回答完了,lz你贴到VB 2010运行成功就给分吧。
      

  6.   

    VB.NET 不行,俺用VB6中文专业版
      

  7.   


    他写错了,应该是 Super Man
      

  8.   

    Public Function 最大公约数(a As Integer, b As Integer) As Integer
        Dim t As Integer
        If a < b Then t = a: a = b: b = t
        
        While b <> 0
            t = a Mod b: a = b: b = t
        Wend
        
        最大公约数 = a
    End Function