How to divide two numbers in C language
This article introduces the relevant knowledge of "how to divide two numbers in C language". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Divide two numbers and, if there is a remainder, output the remainder.
Example
# include
Int main () {
Int dividend, divisor, quotient, remainder
Printf ("enter divisor:")
Scanf ("d", & dividend)
Printf ("enter divisor:")
Scanf ("d", & divisor)
/ / Computing business
Quotient = dividend / divisor
/ / calculate the remainder
Remainder = dividend% divisor
Printf ("quotient =% d\ n", quotient)
Printf ("remainder =% d", remainder)
Return 0
}
Running result:
Input divisor: 5 input divisor: 2 quotient = 2 remainder = 1 "how to divide two numbers in C language" is introduced here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!