Сижу на информатике) 8 класс. Turbo basic. Тема: массивы. Нужно срочно найти произведение четных отрицательных чисел. или найти количество кратных трем или пяти.
Answers & Comments
HRAshton
Я в диалектах не очень, но вот вспомнил VB.net :) Sub Main() Dim a(10) As Integer Dim b As Integer = 1 Dim c As Integer
Dim R As Random = New Random() For i As Integer = 0 To 10 a(i) = R.Next(12) Console.WriteLine("[" + i.ToString() + "] => " + a(i).ToString()) Next
For i As Integer = 0 To 10 If ((a(i) Mod 2 = 0) And (a(i) < 0)) Then b = b * a(i) If ((a(i) Mod 3 = 0) Or (a(i) Mod 5 = 0)) Then c = c + 1 Next Console.WriteLine("Произведение чётных отрицательных: " + b.ToString()) Console.WriteLine("Кол-во кратных 3 или 5: " + c.ToString()) Console.Read() End Sub
Answers & Comments
Sub Main()
Dim a(10) As Integer
Dim b As Integer = 1
Dim c As Integer
Dim R As Random = New Random()
For i As Integer = 0 To 10
a(i) = R.Next(12)
Console.WriteLine("[" + i.ToString() + "] => " + a(i).ToString())
Next
For i As Integer = 0 To 10
If ((a(i) Mod 2 = 0) And (a(i) < 0)) Then b = b * a(i)
If ((a(i) Mod 3 = 0) Or (a(i) Mod 5 = 0)) Then c = c + 1
Next
Console.WriteLine("Произведение чётных отрицательных: " + b.ToString())
Console.WriteLine("Кол-во кратных 3 или 5: " + c.ToString())
Console.Read()
End Sub