早教吧 育儿知识 作业答案 考试题库 百科 知识分享

DimaAsIntegerDimbAsIntegera=100b=5Fora=5To100b=a+bNextaPrintb为什么计算的答案是5045谁给我解释下?

题目详情
Dim a As Integer Dim b As Integer a = 100 b = 5 For a = 5 To 100 b = a + b Next a Print b为什么计算的答案是5045谁给我解释下?
▼优质解答
答案和解析
Dim a As Integer Dim b As Integer a = 100 b = 5 For a = 5 To 100 '主要是这句,需要注意,这里把a的初始值改为了5,所以a会从5开始递增到100 b = a + b Next a Print b