Mister Iks
Mister Iks

Reputation: 195

Calculate result based on percentage in Powershell

I want to calculate the following in Powershell

$x = 100
$y = 25
result = x * y%

Should be really simple, but I can't seem to come up with the right way to calculate the correct result in Powershell

Upvotes: 4

Views: 14340

Answers (1)

Mark Wragg
Mark Wragg

Reputation: 23395

Divide by 100 to get the percentage:

$x = 100
$y = 25
$result = $x * ($y / 100)

Upvotes: 7

Related Questions