测试分割的int是否为整数 [英] testing if a divided int is a whole number

查看:64
本文介绍了测试分割的int是否为整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我将int与另一个int分开,我想看看答案是否是一个整数,你是如何做到的?

Hi i'm dividing an int with another int and i want to see if the answer is a whole number, how do you accomplish this?

推荐答案

你可以使用模数运算符确定整数除法的余数。 请参阅
乘法运算符和模数运算符
You can determine the remainder of integer division by using the modulus operator.  See Multiplicative Operators and the Modulus Operator


这篇关于测试分割的int是否为整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆