Составьте программу для нахождения количества чисел, кратных 3 и 5 в интервале от 300 до 1000.
Answers & Comments
v1248
Excel программа, которая выводит количество чисел кратных 3, 5, 3и5 Sub krat() S3 = 0 S5 = 0 S35 = 0 For i = 300 To 1000 If i / 3 = Int(i / 3) Then S3 = S3 + 1 End If If i / 5 = Int(i / 5) Then S5 = S5 + 1 End If If i / 5 = Int(i / 5) And i / 3 = Int(i / 3) Then S35 = S35 + 1 End If Next i Cells(2, 2) = S3 Cells(3, 2) = S5 Cells(4, 2) = S35 End Sub
0 votes Thanks 0
Mepkypuu
Var k, numb, count:integer; begin for k:= 300 to 1000 do if (k mod 3 = 0) and ( k mod 5 = 0) then count:= count + 1; writeln(count); end.
Answers & Comments
Sub krat()
S3 = 0
S5 = 0
S35 = 0
For i = 300 To 1000
If i / 3 = Int(i / 3) Then
S3 = S3 + 1
End If
If i / 5 = Int(i / 5) Then
S5 = S5 + 1
End If
If i / 5 = Int(i / 5) And i / 3 = Int(i / 3) Then
S35 = S35 + 1
End If
Next i
Cells(2, 2) = S3
Cells(3, 2) = S5
Cells(4, 2) = S35
End Sub
begin
for k:= 300 to 1000 do
if (k mod 3 = 0) and ( k mod 5 = 0) then
count:= count + 1;
writeln(count);
end.