a. Convert the following code segment as follow: -Do while loop → to be converted to → Do Loop Until -Function to be converted to → Subroutine Explain the changes done in the programming structures. private Function computeSum (ByVal num As Integer) As Integer Dim Sum As Integer 0 Dim n As Integer = 1 Do while n <=50 Sum += n n +=1 Loop return n End Function Solution: private Sub computeSum (ByVal num As Integer, byRef sum As integer)

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.1: Function And Parameter Declarations
Problem 13E
icon
Related questions
Question

Using Visual Basic programming language.

I need clear and simple solution and explanation please.

Take your time solving it.

Q1 :
a. Convert the following code segment as follow:
-Do while loop → to be converted to → Do Loop Until
-Function → to be converted to → Subroutine
Explain the changes done in the programming structures.
private Function computeSum (ByVal num As Integer) As Integer
Dim Sum As Integer = 0
Dim n As Integer = 1
Do while n <=50
Sum += n
n +=1
Loop
return n
End Function
Solution:
private Sub computeSum (ByVal num As Integer, byRef sum As integer)
Explanation:
Transcribed Image Text:Q1 : a. Convert the following code segment as follow: -Do while loop → to be converted to → Do Loop Until -Function → to be converted to → Subroutine Explain the changes done in the programming structures. private Function computeSum (ByVal num As Integer) As Integer Dim Sum As Integer = 0 Dim n As Integer = 1 Do while n <=50 Sum += n n +=1 Loop return n End Function Solution: private Sub computeSum (ByVal num As Integer, byRef sum As integer) Explanation:
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning