<h3>PascalABC.NET 3.4.2, сборка 1837 от 11.10.2018</h3><h3>Внимание! Если программа не работает, обновите версию!</h3>
begin
var b := Arr(2, 1, 3, 5, 4, 9, 7, 8, 12, 10);
b.Sum.Println
end.
<h2>61 </h2>
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::fixed;
#include <cstring>
using std::strcpy;
#include <iomanip>
using std::setprecision;
int main()
{
char s[100], temp[100];
int counter = 0, counter1 = 0;
cout << "Enter the string: ";
cin.getline(s, 100);
strcpy(temp, s);
//Определяем общее количество слов
//и количество слов с буквай d
char *ptr = strtok(temp, " ");
while(ptr)
{
for(int i = 0; *(ptr + i) != NULL; i++)
{
if(*(ptr + i) == 'd')
{
counter1++;
break;
}
}
counter++;
ptr = strtok(NULL, " ");
}
cout << setprecision(2) << fixed << (counter1 * 100 / double(counter)) << '%' << endl;
return 0;
}
Сам пременные объявишь
begin
read(max);
read(min);
while(n <> 0) do // пока не равну нолю делать то то. ноль - знак окончание ввода чисел
if max < min then min := max;
writeln(max);
end.
Program n1;
const n=10;
var a: array[1..n] of integer;
i,k,sum: integer;
begin
randomize;
sum:=0;
k:=0;
for i:=1 to n do
begin
a[i]:=random(21);
sum:=sum+a[i];
end;
for i:=1 to n do if a[i] > sum/n then k:=k+1;
writeln(k);
end.
Program arr;
var
a: array[1..15] of integer;
count,count_odd,num,sum,mult: integer;
begin
count := 1;
count_odd := 1;
num := 3;
sum := 0;
mult := 1;
while count <= 15 do
begin
a[count] := num;
count := count + 1;
num := num + 3;
end;
while count_odd <= 15 do
begin
sum := sum + a[count_odd];
mult := mult * a[count_odd];
count_odd := count_odd + 2;
end;
writeln('Массив из 15 элементов: 3, 6, 9, ..., 45');
writeln('Сумма элементов с нечетными индексами: ', sum);
writeln('Произведение элементов с нечетными индексами: ', mult);
end.