Private Sub form_click()
Dim i As Integer, j As Integer
For i = 2 To 100 Step 2
j = j + 1
If j = 6 Then
Print
j = 1
Else
End If
Print i;
Next i
End Sub
#include"stdio.h"
#include"conio.h"
void
main()
{
int
i,j=0;
for(i=0;i<=100;i++)
{
if(i%2==0)
{
j=j+1;
if(j==10)
{
printf("%d\n",i);
j=0;
}
else
printf("%d\t",i);
}
}
getch();
}
我用的win-tc所以加了getch()这个函数,另外也可以把结果存到数组上再输出等!
Private Sub Command1_Click()
Dim i As Integer, j As Integer
For i = 2 To 100 Step 2
Print i;
j = j + 1
If j = 5 Then
j = 0
Print
End If
Next
End Sub
for i=2 to 100 step 2
print i;
if i mod 10=0 then print ""
next i
dim i as integer
dim strOut as string
for i = 2 to 100 step 2
strOut = strOut & " " & i
if i mod 10 = 0 then
strOut = strOut & vbnewline
end if
next
label1= strOut