Answer to Question #187751 in Visual Basic for tafadzwa

Question #187751

write vb code to calculate the number of dozens and number of eggs remaining from a total number of eggs


1
Expert's answer
2021-05-01T08:12:29-0400
Module Module1


    Sub Main()
        'get the total number of eggs
        Console.Write("Enter the total number of eggs: ")
        Dim totalNumberEggs As Integer = Integer.Parse(Console.ReadLine())
        Dim modValue As Integer = (totalNumberEggs Mod 12)
        Dim numberDozens As Integer = (totalNumberEggs - modValue) / 12
        'display the number of dozens
        Console.WriteLine("The number of dozens: {0}", numberDozens)
        'display the number of eggs remaining from a total number of eggs
        Console.WriteLine("The number of eggs remaining from a total number of eggs: {0}", (totalNumberEggs - numberDozens * 12))


        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