本文介绍了C ++ Help:数字总和可被n整除的数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数字的总和可以被n整除的数字。



i真的不明白它应该如何工作,但是每个数字都应该用数字和那么这些数字的总和应该是否可被n整除。 (这只是猜测)



非常感谢任何帮助。

numbers whose sum of the digits is divisible by n.

i dont really understand how it`s supposed to work, but every number should be divided in digits and then the sum of those digits should be or not be divisible by n. (it is only a guess)

Any help is highly appreciated.

推荐答案

digit = value % 10;
value /= 10;



然后你所要做的就是添加数字...



检查可分性更容易:x可以被x除以y模数y为零


Then all you have to do is add the digits...

Checking divisibility is even easier: x is divisible by y of x modulus y is zero


这篇关于C ++ Help:数字总和可被n整除的数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 07:50
查看更多