#include "stdio.h"
void main()
{
int i,sum=0;
for(i=3;i<=100;i+=3)
if(i%7!=0)
{
printf("%d能被3整除,并且不能被7整除\n",i);
sum+=i;
}
printf("这些数字的和为:%d",sum);
}
#include
int main()
{
int sum=0,i;
for(i=1;i<101;i++)
{
if(i%3==0 && i%7!=0)
sum+=i;
}
printf("%d",sum);
}
Private Sub Command1_Click()
Dim i As Integer
For i = 7 To 100 Step 7
If i Mod 3 = 0 Then Print i;
Next
Print
i = 7
Do While i < 100
If i Mod 3 = 0 Then Print i;
i = i + 7
Loop
Print
i = 7
Do
If i Mod 3 = 0 Then Print i;
i = i + 7
Loop Until i > 100
Print
End Sub
#include
int main(){
int i,sum;
sum=0;
for (i=1;i<=100;i++)
if (i%3==0&&i%7!=0)
sum+=i;
printf("%d\n",sum);
return 0;
}