<\/span><\/h2>\n\n\n\n\/\/ C Program To Compute Quotient and Remainder\n#include <stdio.h>\nint main(){\n int a, b, quotient, remainder;\n \n \/\/ Asking for Input\n printf(\"Enter the Dividend: \");\n scanf(\"%d\", &a);\n \n printf(\"Enter the Divisor: \");\n scanf(\"%d\", &b);\n \n \/\/ Calculate Quotient \n quotient = a \/ b;\n \/\/ Calculate Remainder\n remainder = a % b;\n \n \/\/ Displays Output\n printf(\"Quotient is: %d \\n\", quotient);\n printf(\"Remainder is: %d\", remainder);\n return 0;\n}\n<\/pre>\n\n\n\nOutput<\/strong><\/p>\n\n\n\nEnter the Dividend:<\/strong> 108\r\nEnter the Divisor:<\/strong> 7\r\nQuotient is:<\/strong> 15 \r\nRemainder is:<\/strong> 3\r<\/code><\/pre>\n\n\n\n<\/span>How Does This Program Work ?<\/strong><\/span><\/h2>\n\n\n\nint a, b, quotient, remainder;<\/strong>\r<\/code><\/pre>\n\n\n\nIn the above example, we have declared four integer data types variable named as a, b, quotient and remainder.<\/p>\n\n\n\n
\/\/ Asking for Input\r\n printf(\"Enter the Dividend: \");\r\n scanf(\"%d\", &a);\r\n \r\n printf(\"Enter the Divisor: \");\r\n scanf(\"%d\", &b);\r\n<\/strong><\/code><\/pre>\n\n\n\nThen, the user is asked to enter the input integers (dividend and divisor). The value of dividend and divisor is stored in a<\/strong> and b<\/strong> named variables respectively.<\/p>\n\n\n\n \/\/ Calculate Quotient \r\n quotient = a \/ b;\r\n \/\/ Calculate Remainder\r\n remainder = a % b;<\/strong>\r\n<\/code><\/pre>\n\n\n\nThe quotient is calculated using \/<\/strong> (division operator) and stored in the quotient<\/em><\/strong> named variable.\u00a0<\/p>\n\n\n\nSimilarly, the remainder is calculated using %<\/strong> (modulo operator) and stored in the remainder <\/strong>named variable.<\/p>\n\n\n\n\/\/ Displays Output\r\n printf(\"Quotient is: %d \\n\", quotient);\r\n printf(\"Remainder is: %d\", remainder);<\/strong>\r<\/code><\/pre>\n\n\n\nFinally, the quotient and the remainder calculated in the previous step is displayed to the screen as output using printf()<\/strong> function.<\/p>\n\n\n\nSome used terms are as follow:\u00a0<\/p>\n\n\n\n
#include <stdio.h><\/strong> – In the first line we have used #include, it is a preprocessor command that tells the compiler to include the contents of the stdio.h(standard input and output) file in the program.<\/p>\n\n\n\nThe stdio.h <\/strong>is a file which contains input and output functions like scanf()<\/strong> and printf()<\/strong> to take input and display output respectively.<\/p>\n\n\n\nInt main()<\/strong> – Here main() is the function name and int is the return type of this function. The Execution of any Programming written in C language begins with main() function.<\/p>\n\n\n\nscanf()<\/strong> – scanf() function is used to take input from the user. Here %d<\/strong> indicates that we are reading Integer Data Type.<\/p>\n\n\n\nprintf()<\/strong> – printf() function is used to display and print the string under the quotation to the screen.<\/p>\n\n\n\n\/<\/strong> – Divides Numerator by Denominator and gives quotient. This is known as Division Operator.<\/p>\n\n\n\n% <\/strong>– It is known as Modulus Operator and provides remainder after division.<\/p>\n\n\n\n\/\/ <\/strong>– Used for Commenting in C<\/p>\n\n\n\n<\/span>Conclusion<\/strong><\/span><\/h2>\n\n\n\nI hope after going through this tutorial , you clearly understood how to compute quotient and remainder in the C Programming language.<\/p>\n\n\n\n
If you still have any doubt regarding the program, feel free to contact us in the comment Section. We will be delighted to help you.<\/p>\n","protected":false},"excerpt":{"rendered":"
In this post, you will learn how to compute quotient and remainder when an integer is divided by another integer in C Programming language.<\/p>\n","protected":false},"author":2,"featured_media":3987,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[167,294],"tags":[222,228,229,225,226,227,206],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.codingbroz.com\/wp-content\/uploads\/2021\/08\/c-program-to-compute-quotient-and-remainder-codingbroz.png","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/3981"}],"collection":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/comments?post=3981"}],"version-history":[{"count":4,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/3981\/revisions"}],"predecessor-version":[{"id":3993,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/posts\/3981\/revisions\/3993"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/media\/3987"}],"wp:attachment":[{"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/media?parent=3981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/categories?post=3981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codingbroz.com\/wp-json\/wp\/v2\/tags?post=3981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}