如何添加,muiltiply和分数括号中的数字

时间:2018-05-29 02:57:43

标签: vb.net

我想知道是否有人可以帮助我使用vb net解决这个数学

Dmj = 1(4 + 0.5)+2(1.5 + 0.5)+ 2(2 + 0.5)+7(3 + 0.5)/ 12 12是括号外的数字总和(即1 + 2 + 2) +7)  = 4.5 + 4 + 5 + 24.5     12 = 38/12 = 3.17

下面的代码没有给我正确答案3.17

Public Class Form3

***22:29:36   File "createJenkinsJobs.py", line 1, in <module>
22:29:36     from jenkinsapi.jenkins import Jenkins
22:29:36 ImportError: No module named jenkinsapi.jenkins
22:29:36 Build step 'Execute shell' marked build as failure
22:29:36 Finished: FAILURE*** 

结束班

1 个答案:

答案 0 :(得分:-2)

使用此代码

我已成功在Visual Studio 2010中测试了此代码

 Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim Maxnumber As Double
    Dim total, total2, total3, total4 As Double
    Dim input, input2 As Double
    Dim num As Double
    Dim accu As Double
    Maxnumber = CDbl(InputBox("How many numbers to you wish to sum?"))
    total = 0

    For x = 1 To Maxnumber
        input = CDbl(InputBox("Enter the number"))

        input2 = CDbl(InputBox("Enter the Distance"))

        If input = 0 And input2 = 0 Then
            Exit For
        Else
            num = CDbl(input)
            accu = CDbl(input2)
            total += num

            total2 = num * (accu + 0.5)
            total3 = total3 + total2
            total4 = total3 / total
        End If
    Next
    MessageBox.Show(total4)
End Sub