求高手帮我做个简单的VB程序Divide the number with 2.Convert the result to an integer.Multiply this integer with 2.If the product is equal to the original number,it is an even number,otherwise it is an odd number.To convert a number to an i
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 02:22:17
求高手帮我做个简单的VB程序Divide the number with 2.Convert the result to an integer.Multiply this integer with 2.If the product is equal to the original number,it is an even number,otherwise it is an odd number.To convert a number to an i
求高手帮我做个简单的VB程序
Divide the number with 2.Convert the result to an integer.Multiply this integer with 2.If the product is equal to the original number,it is an even number,otherwise it is an odd number.
To convert a number to an integer you can use the function int(x) which returns the integer part of a value x.
求高手帮我做个简单的VB程序Divide the number with 2.Convert the result to an integer.Multiply this integer with 2.If the product is equal to the original number,it is an even number,otherwise it is an odd number.To convert a number to an i
大体伪代码框架如下
y = int(x);
if(y/2*2 == y)
even()
else
odd()
另,这算法好傻,最快判断奇偶的话,只需要看整数的最后1位是0还是1就行了(因为计算机用的是二进制数)