一个简单的计算鸡兔同笼题的vb.net代码
一个简单的计算鸡兔同笼题的vb.net代码
Module Module1
Sub Main()
Dim jiao As Integer, tou As Integer 'jiao是下有多少只脚,tou是上有多少个头
tou = Console.ReadLine()
jiao = Console.ReadLine()
Dim x, y As Integer 'x是有多少只鸡,y是有多少只兔
x = (4 * tou - jiao) / 2
y = tou - x
Console.WriteLine("鸡的个数为:" & x)
Console.WriteLine("兔的个数为:" & y)
End Sub
End Module
Sub Main()
Dim jiao As Integer, tou As Integer 'jiao是下有多少只脚,tou是上有多少个头
tou = Console.ReadLine()
jiao = Console.ReadLine()
Dim x, y As Integer 'x是有多少只鸡,y是有多少只兔
x = (4 * tou - jiao) / 2
y = tou - x
Console.WriteLine("鸡的个数为:" & x)
Console.WriteLine("兔的个数为:" & y)
End Sub
End Module
刘钊-07网5- 帖子数 : 1
注册日期 : 08-03-18
您在这个论坛的权限:
您不能在这个论坛回复主题