November 2018
Intermediate to advanced
566 pages
17h 15m
English
The input will be taken as a string. The output would also be string, but with octal, hexadecimal, and binary representations. We will use a .NET accelerator for this:
$InputString = Read-Host "Enter an integer" Write-Host "Octal representation: " -NoNewline Write-Host "$([Convert]::ToString($InputString, 8))" Write-Host "Hexadecimal representation: " -NoNewline Write-Host "$([Convert]::ToString($InputString, 16))" Write-Host "Binary representation: " -NoNewline Write-Host "$([Convert]::ToString($InputString, 2))"
Do not forget to try negative numbers as well:
Read now
Unlock full access