{"id":1329,"date":"2022-03-03T06:48:57","date_gmt":"2022-03-03T06:48:57","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=1329"},"modified":"2022-03-03T06:48:57","modified_gmt":"2022-03-03T06:48:57","slug":"compute-quotient-and-remainder","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/03\/03\/compute-quotient-and-remainder\/","title":{"rendered":"Compute Quotient and Remainder"},"content":{"rendered":"\n<p>In this program, you&#8217;ll learn to compute quotient and remainder from the given dividend and divisor in Java.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example: Compute Quotient and Remainder<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>public class QuotientRemainder {\n\n  public static void main(String&#91;] args) {\n\n    int dividend = 25, divisor = 4;\n\n    int quotient = dividend \/ divisor;\n    int remainder = dividend % divisor;\n\n    System.out.println(\"Quotient = \" + quotient);\n    System.out.println(\"Remainder = \" + remainder);\n  }\n}<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><samp>Quotient = 6\nRemainder = 1<\/samp><\/code><\/pre>\n\n\n\n<p>In the above program, we have created two variables dividend and divisor. Here, we are calculating the quotient and remainder by dividing 25 by 4.<\/p>\n\n\n\n<p>To find the quotient, we have used the&nbsp;<code>\/<\/code>&nbsp;operator. We have divided&nbsp;<var>dividend (25)<\/var>&nbsp;by&nbsp;<var>divisor (4)<\/var>. Since both&nbsp;<var>dividend<\/var>&nbsp;and&nbsp;<var>divisor<\/var>&nbsp;are integers, the result will also be integer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>25 \/ 4 \/\/ results 6.5\n\/\/ convert 6.5 to integer\n\/\/ output will be 6<\/code><\/pre>\n\n\n\n<p>Likewise, to find the remainder we use the&nbsp;<code>%<\/code>&nbsp;operator. Here, the&nbsp;<var>dividend<\/var>&nbsp;is divided by the&nbsp;<var>divisor<\/var>&nbsp;and the remainder is returned by the&nbsp;<code>%<\/code>&nbsp;operator.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>25 % 4 \/\/ results 1<\/code><\/pre>\n\n\n\n<p>Finally,&nbsp;<var>quotient<\/var>&nbsp;and&nbsp;<var>remainder<\/var>&nbsp;are printed on the screen using&nbsp;<code>println()<\/code>&nbsp;function.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this program, you&#8217;ll learn to compute quotient and remainder from the given dividend and divisor in Java. Example: Compute Quotient and Remainder Output: In the above program, we have created two variables dividend and divisor. Here, we are calculating the quotient and remainder by dividing 25 by 4. To find the quotient, we have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[287],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1329"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=1329"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1329\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=1329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=1329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=1329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}