如何使用Do ... Loop
编号:QA001991
建立日期: 1999年11月8日 最后修改日期:1999年11月8日
所属类别:
Joanny TM Yip:
操作系统: VB6
编程工具: Loop
问题: The question is:
Teacher Student
Height 165 cm 240 cm
GrowthRate 2cm/M 1cm/M
Assume the groth rate isn't changed with time.
Write the code to calculate the number of months the teacher will be taller than the student. It need to use Top-checking loop -- Do Until ...Loop.
回答:
Techer = 165
Student = 240
n = 0
Do Until Techer > Student
Techer = Techer + 2
Student = Student + 1
n= n + 1
Loop
Print n
此问题由李海回答。
| |
|
|
| |
|
|