{"id":76473,"date":"2016-01-29T11:59:00","date_gmt":"2016-01-29T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/01\/29\/powertip-return-remainder-after-dividing-two-numbers\/"},"modified":"2019-02-18T09:20:04","modified_gmt":"2019-02-18T16:20:04","slug":"powertip-return-remainder-after-dividing-two-numbers","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-return-remainder-after-dividing-two-numbers\/","title":{"rendered":"PowerTip: Return remainder after dividing two numbers"},"content":{"rendered":"<p><b>Summary<\/b>: Use Windows PowerShell to return the remainder after dividing two numbers.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;How can use Windows PowerShell to divide two numbers and only return the remainder (called a&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Modulo_operation\" target=\"_blank\">modulo operation<\/a>)?<\/p>\n<p style=\"margin-left:30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>&nbsp;In Windows PowerShell, the&nbsp;<a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/hh848303.aspx\" target=\"_blank\">modulo operator<\/a>&nbsp;is the&nbsp;<b>%<\/b>&nbsp;sign. Here are a few examples of how to use it:<\/p>\n<p style=\"margin-left:120px\">PS C:\\&gt; 3 % 2<\/p>\n<p style=\"margin-left:120px\">1<\/p>\n<p style=\"margin-left:120px\">PS C:\\&gt; 5 % 2<\/p>\n<p style=\"margin-left:120px\">1<\/p>\n<p style=\"margin-left:120px\">PS C:\\&gt; 11 % 2<\/p>\n<p style=\"margin-left:120px\">1<\/p>\n<p style=\"margin-left:30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7610.Dr.ScriptoForTips.jpg\" alt=\" \" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Use Windows PowerShell to return the remainder after dividing two numbers. &nbsp;How can use Windows PowerShell to divide two numbers and only return the remainder (called a&nbsp;modulo operation)? &nbsp;In Windows PowerShell, the&nbsp;modulo operator&nbsp;is the&nbsp;%&nbsp;sign. Here are a few examples of how to use it: PS C:\\&gt; 3 % 2 1 PS C:\\&gt; 5 % [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[51,164,356,3,45],"class_list":["post-76473","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-getting-started","tag-math","tag-powertip","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Use Windows PowerShell to return the remainder after dividing two numbers. &nbsp;How can use Windows PowerShell to divide two numbers and only return the remainder (called a&nbsp;modulo operation)? &nbsp;In Windows PowerShell, the&nbsp;modulo operator&nbsp;is the&nbsp;%&nbsp;sign. Here are a few examples of how to use it: PS C:\\&gt; 3 % 2 1 PS C:\\&gt; 5 % [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/76473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=76473"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/76473\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=76473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=76473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=76473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}