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

vb语言,整数分解因式,如把24分解成1×2×2×2×3,把-42分解成-1×2×3×7

题目详情
vb语言,整数分解因式,如把24分解成1×2×2×2×3,把-42分解成-1×2×3×7
▼优质解答
答案和解析
Private Sub Command1_Click()
a = CInt(Text1.Text)
If a < 0 Then
Print -1;
a = -a
Else
Print 1;
End If
i = 2
Do While i * i <= a
Do While a Mod i = 0
Print "*"; i;
a = a \ i
Loop
i = i + 1
Loop
If a > 1 Then Print "*"; a;
Print
End Sub