[Chapter 12] [Code] [obtain a product of respective digits number]

"The product of the number you get a number" Benpian program reference code excerpt from "C language classroom doubts" on page 12 for more C language programming reference code can be micro-channel sweep end the card into the classroom!


First, the programming requirements

Requires obtaining a digital product of each digit, such as input the number "123", a product of the output of each digit "6"; another example, the input number "34567", a product of the output of each of the digits "2520."

 

Second, the reference code

Do you have ideas yet? I give one of the C implementation, see photos.

 

My implementation is to use the C language "/" and "%" two operators, the former is the division operator, which is the remainder operator. Will be a integer number of bits at the end of the time use a "%" operator, using "/" weed out a number of bits will end when the operator. Really interesting!

 

Third, the way to join the classroom

Letter card micro sweep downward to join.

Guess you like

Origin www.cnblogs.com/itblog/p/11440855.html