Sha256: 656e7352119444bee3e39c9bf2c993804096eb03e8b9698a92a3ed687799e3f9
Contents?: true
Size: 801 Bytes
Versions: 10
Compression:
Stored size: 801 Bytes
Contents
$a = [int] (Read-Host First Number) $b = [int] (Read-Host Second Number) Write-Host "Sum: $($a + $b)" Write-Host "Difference: $($a - $b)" Write-Host "Product: $($a * $b)" Write-Host "Quotient: $($a / $b)" Write-Host "Quotient, round to even: $([Math]::Round($a / $b))" Write-Host "Remainder, sign follows first: $($a % $b)" Numbers are automatically converted to accomodate for the result. This means not only that Int32 will be expanded to Int64 but also that a non-integer quotient will cause the result to be of a floating-point type. The remainder has the sign of the first operand. No exponentiation operator exists, but can be worked around with the .NET BCL: [Math]::Pow($a, $b)
Version data entries
10 entries across 7 versions & 1 rubygems