Static void Main(string[] args) { int count = 0; Console.Write("Введите размерность массива: "); int n = Convert.ToInt32(Console.ReadLine()); int[] mas = new int[n]; Console.WriteLine("Заполните массив: "); for (int i = 0; i < n; i++) { Console.Write("\t{0} элемент массива: ", i + 1); mas[i] = Convert.ToInt32(Console.ReadLine()); } for (int i = 0; i < n; i++) if (mas[i] > 0 && mas[i] % 2 == 0) count++; Console.WriteLine("Из {0} элементов массива {1} элементов являются положительными четными",n,count); Console.WriteLine("{0}% элементов являются положительными четными", (double)count/n*100); Console.ReadLine(); }
Sub Ìàêðîñ1() Dim Sum(heigth - 1, width - 1) Dim Product(heigth - 1, width - 1)
For i = 0 To heigth - 1 For j = 0 To width - 1 Sum(i, j) = i + j Product(i, j) = i * j Next j Next i
Call Show(Sum, 0, 0) Call Show(Product, 0, 12) End Sub
Sub Show(ByRef m, dx, dy) For i = 0 To heigth - 1 For j = 0 To width - 1 ActiveSheet.Cells(dx + i + 1, dy + j + 1).Value = Hex(m(i, j)) Next j Next i End Sub
// PascalABC.NET 3.0, сборка 1111 var a,b:BigInteger; sa,sb:string; begin Write('Первое слагаемое: '); Readln(sa); if BigInteger.TryParse(sa,a)=False then Writeln('Это не целое число!') else begin Write('Второе слагаемое: '); Readln(sb); if BigInteger.TryParse(sb,b)=False then Writeln('Это не целое число!') else Writeln('Точный результат: ',a+b) end end.
Тестовое решение: Первое слагаемое: 5423323409523846095938445870434764308454095 Второе слагаемое: 7425543205430235436743455446541423534233 Точный результат: 5430748952729276331375189325881305731988328
{
int count = 0;
Console.Write("Введите размерность массива: ");
int n = Convert.ToInt32(Console.ReadLine());
int[] mas = new int[n];
Console.WriteLine("Заполните массив: ");
for (int i = 0; i < n; i++)
{
Console.Write("\t{0} элемент массива: ", i + 1);
mas[i] = Convert.ToInt32(Console.ReadLine());
}
for (int i = 0; i < n; i++)
if (mas[i] > 0 && mas[i] % 2 == 0)
count++;
Console.WriteLine("Из {0} элементов массива {1} элементов являются положительными четными",n,count);
Console.WriteLine("{0}% элементов являются положительными четными", (double)count/n*100);
Console.ReadLine();
}