Private Sub Command1_Click()
Dim s As Long
Dim i As Integer, j As Integer
s = 0
Print "100-500之间的奇数为:"
For i = 101 To 500 Step 2
Print i;
j = j + 1
If j Mod 10 = 0 Then Print
s = s + i
Next i
Print "奇数的和为"; s
End Sub
int jishuhe = 0;
int oushuhe = 0;
for (int i=1; i<=100; i++)
{
if (i % 2 == 0)
{
oushuhe += i;
}
else
{
jishuhe += i;
}
}
输出自己写吧
2500