Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27186

VS 2010 Can someone complete this Decimal to Binary code? NEED HELP

$
0
0
For the code I want someone to complete the code but make it so that only the Binary conversion is shown from the loop, and so that none of the input = input / 2 working out is shown(i tried to use 2 variable to avoid this issue but didnt work)... And also, try and make it so that the binary conversion is all in one line, using console.write, and maybe changing the loop using For count string. Thanks
Heres my code:
Module Module1

Sub Main()

Dim input1 As Integer


Console.WriteLine("This is a Decimal to Binary converter")
Do
Console.WriteLine("Enter your decimal: ")
input1 = Console.ReadLine()
If input1 > 255 Then 'MAX AMOUNT IS 255 FOR DECIMAL'
Console.WriteLine("You have exceeded the value limit of 255")
Console.WriteLine("Please try again")
Console.WriteLine(" ")
End If
Loop Until input1 <= 255

Do Until input1 = 0
Console.WriteLine("Binary conversion---- (" & input1 Mod 2 & ")")
input1 = input1 / 2 'THIS PART I DON'T WANT SHOWN IN THE CONSOLE APPLICATION'
Console.WriteLine(input1)
Loop
Console.ReadLine()

End Sub

End Module

Viewing all articles
Browse latest Browse all 27186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>