Answer to Question #268003 in Visual Basic for ray

Question #268003

1.      Consider the following code segments using the Boolean variables a, b, c and d. 

 If Not c Or d Then

 If a And c Then  

 lblOut.Text = “1”

 ElseIf b Then  

 lblOut.Text = “2”

 Else

 lblOut.Text = “3”

 End If

 ElseIf Not c = d Then

 lblOut.Text = “4”

 ElseIf c Then 

 lblOut.Text = “5”

 Else lblOut.Text = “6”

End If

 a. Give the values for a, b, c and d that will cause the above code  segment to display 1 in lblOut. 

 b. Give the values for a, b, c and d that will cause the above code segment to display 4 in lblOut.

 

2.  Write VB.NET code that will use a loop to calculate the sum of all integer numbers between 5 and 100 that are divisible by both 5 and 6.

You may choose to use any looping structure.

Use the following variable declarations.

  Dim intCounter As Integer ‘loop counter variable

  Dim intSum As Integer ‘to accumulate the summation



1
Expert's answer
2021-11-22T15:17:50-0500




 a. Give the values for a, b, c and d that will cause the above code  segment to display 1 in lblOut. 
a  = True
b  = False
c  = True
d  = True




 b. Give the values for a, b, c and d that will cause the above code segment to display 4 in lblOut.
a  = True
b  = False
c  = True
d  = False




 


2.  Write VB.NET code that will use a loop to calculate the sum of all integer numbers between 5 and 100 that are divisible by both 5 and 6.




Imports System.IO


Module Module1
    Sub Main()
        Dim intCounter As Integer ‘loop counter variable
        Dim intSum As Integer 'to accumulate the summation
        intCounter = 5
        intSum = 0
        While intCounter <= 110
            If intCounter Mod 5 = 0 And intCounter Mod 6 = 0 Then
                intSum += intCounter
            End If
            intCounter += 1
        End While


        Console.WriteLine("Sum " + intSum.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