如何检查是否可以被某个数整除? [英] How to check if divisible by a certain number?
本文介绍了如何检查是否可以被某个数整除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使整数乘以一个数字,然后能够检查该整数是否可以被某个整数整除.我希望它等于2个数字,所以在数学运算后说它等于1或2,具体取决于当前的整数 数字. 很抱歉,如果这令人困惑,但我真的不知道如何解释. . 您不妨检查一下模运算符(%).
I am trying to make it to where in integer counts up by a number and i am able to check if that integer is divisible by a certain number. I want it to come out to equal 2 numbers so say after the math it equals 1 or 2 depending on what the integers current number. Sorry if this is being confusing but I don't really know how to explain it.
解决方案
Your teacher really wants you to work this out yourself. You may wish to check out the modulo operator (%).
这篇关于如何检查是否可以被某个数整除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文