gpt4 book ai didi

objective-c - Objective-C : How do i find out if a number is divisible by another number?

转载 作者:太空狗 更新时间:2023-10-30 03:34:10 25 4
gpt4 key购买 nike

在 objective-c (Mac 开发)中。我如何确定一个数字是否可以被另一个数字整除而不是小数?

最佳答案

假设您要处理整数,请使用取模函数:

if ((a % b) == 0) {
// A is divisible by B
} else {
// A isn't divisible by B
}

关于objective-c - Objective-C : How do i find out if a number is divisible by another number?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3467728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com