继续造成零?

时间:2015-07-03 22:20:41

标签: vb.net

我的vb.net课程需要一些帮助。我指定的项目是制作一个平均10个数字的程序。我试图尽我所能写出它,但结果却一直变为零。请帮我平均10个数字。

Module Module1
Sub Main()
    Dim One As Integer
    Dim Two As Integer
    Dim Three As Integer
    Dim Four As Integer
    Dim Five As Integer
    Dim Six As Integer
    Dim Seven As Integer
    Dim Eight As Integer
    Dim Nine As Integer
    Dim Ten As Integer
    Dim A As Integer
    Dim B As Integer
    B = One + Two + Three + Four + Five + Six + Seven + Eight + Nine + Ten
    A = B / 2
    Console.WriteLine("Enter The First Number")
    One = Console.ReadLine()
    Console.WriteLine("Enter The Seconed Number")
    Two = Console.ReadLine()
    Console.WriteLine("Enter The Third Number")
    Three = Console.ReadLine()
    Console.WriteLine("Enter The Fourth Number")
    Four = Console.ReadLine()
    Console.WriteLine("Enter The Five Number")
    Five = Console.ReadLine()
    Console.WriteLine("Enter The Six Number")
    Six = Console.ReadLine()
    Console.WriteLine("Enter The Seven Number")
    Seven = Console.ReadLine()
    Console.WriteLine("Enter The Eight Number")
    Eight = Console.ReadLine()
    Console.WriteLine("Enter The Nine Number")
    Nine = Console.ReadLine()
    Console.WriteLine("Enter The Ten Number")
    Ten = Console.ReadLine()
    Console.WriteLine(B)
    Console.ReadKey()
End Sub

结束模块

1 个答案:

答案 0 :(得分:0)

问题是您在读取用户输入之前分配值只是将其更改为结尾。

   B = One + Two + Three + Four + Five + Six + Seven + Eight + Nine + Ten
    A = B / 2