Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Return remainder after dividing two numbers

$
0
0

Summary: Use Windows PowerShell to return the remainder after dividing two numbers.

Hey, Scripting Guy! Question How can use Windows PowerShell to divide two numbers and only return the remainder (called a modulo operation)?

Hey, Scripting Guy! Answer In Windows PowerShell, the modulo operator is the % sign. Here are a few examples of how to use it:

PS C:\> 3 % 2

1

PS C:\> 5 % 2

1

PS C:\> 11 % 2

1


Viewing all articles
Browse latest Browse all 3333

Trending Articles



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