一道小学数学题!帮忙,各位大哥!

lzm67836089 2006-06-14 10:50:15
题目是:
一个数除2余1,除3余2,除4余3,除5余4,求这个数这小是多少?

我是这样写的,估计是错大了:

Dim a As Integer = 2
Dim b As Integer = 3
Dim c As Integer = 4
Dim d As Integer = 5
Dim f As Integer = 1
Dim h As Integer
f = h Mod a
a = h Mod b
b = h Mod c
c = h Mod d
MsgBox(h.MinValue)
代码中不加MinValue调试结果是0,加了minvalue结果成负数了!
-----------------------------
那位朋友能给出一个详细的代码及注释?
谢谢了!
...全文
60 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cfreez 2006-06-14
  • 打赏
  • 举报
回复
循环测试
dim f as integer
for h=9 to 10000
if h mod 2 =1 and h mod 3=2 and h mod 4=3 and h mod 5=4 then
MsgBox(h)
exit for
end if
next
handi 2006-06-14
  • 打赏
  • 举报
回复
int n = 1;
while (true)
{
if ((n % 3 == 2) && (n % 4 == 3) &&(n % 5 == 4))
break;
n += 2;
}
MessageBox.Show(n.ToString());

自己改成VB。
sxyjwfeng 2006-06-14
  • 打赏
  • 举报
回复
这个数加1便是2、3、4、5的公倍数。即3*4*5=60 -1 为59

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧