用VB写出1-100的所有奇数和偶数和

问题描述:

用VB写出1-100的所有奇数和偶数和

Private Sub Command1_Click()Dim i,sum1,sum2 As Integersum1 = 0sum2 = 0For i = 1 To 100If i Mod 2 = 1 Thensum1 = sum1 + iElsesum2 = sum2 + iEnd IfNext iPrint "奇数和为" & sum1Print "偶数和为" & sum2End...