Answer to Question #195603 in Visual Basic for zack

Question #195603

Assume that z has been initialized to 50. The values from 0 to 50 should be totaled.

 While (z>=0)

 sum = sum + z


1
Expert's answer
2021-05-19T14:58:08-0400
Module Module1
    Sub Main()
        Dim z As Integer = 50
        Dim sum As Integer = 0
        While (z >= 0)
            sum = sum + z
            z -= 1
        End While
        Console.WriteLine("Sum = " + sum.ToString())
        Console.ReadLine()
    End Sub
End Module

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS