Var A: array [1..10] of integer; i, count: byte; mult: integer; begin writeln('Сгенерированный массив.'); randomize; for i := 1 to 10 do begin A[i] := random(11) + 10; writeln(A[i]:4); end;
count := 0; mult := 1;
for i := 1 to 10 do if A[i] mod 3 = 0 then begin count := count + 1; mult := mult * A[i]; end;
if (count = 1) or (count = 0) then writeln('Количество элементов кратных 3 = ', count) else writeln('Количество элементов кратных 3 = ', count, ' Произведение этих элементов = ', mult); readln; end.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//Дана последовательность целых чисел вывести на печать только те числа для которых a >=i в С#
Console.WriteLine("Введи i");
int i = int.Parse(Console.ReadLine());
Console.WriteLine("Введи число целых чисел");
int n = int.Parse(Console.ReadLine());
int[] a = new int[n];
Console.WriteLine("Введи числа");
for (int j = 0; j < n; j++)
{
a[j] = int.Parse(Console.ReadLine());
}
Console.WriteLine("ответ");
for (int j = 0; j < n; j++)
{
if (a[j] >= i)
Console.WriteLine(a[j]);
}
Console.ReadKey();
}
}
}