ответ:
using system;
using system.collections.generic;
using system.linq;
using system.text;
namespace consoleapplication4
{
class program
{
// дан массив с1, с2, …, с24. в массиве есть два элемента равные 0. заменить все элементы, стоящие между ними, на единицы
static void main(string[] args)
{
const int n = 24; // размер массива
int[] с = new int[n]; // создали массив
for (int i = 0; i < n; i++) // вводим элементы массива
{
с[i] = int.parse(console.;
}
bool check = false; // индикатор замены (пока что выключен)
for (int i = 0; i < n; i++) // цикл для выполнения замены
{
if (с[i] == 0) // если проверемый элемент нулевой, то переулючить индикатор замены и закончить текущую иттерацию
{
check = ! check;
continue;
}
if (check == true) // если индикатор замены включен, то заменяем текущий элемент
с[i] = 1;
}
for (int i = 0; i < n; i++) // выводим элементы массива
{
console.writeline(с[i]);
}
console.readkey(); // ждем нажатия клавиши
}
}
}
объяснение:
1)
var
str : string;
begin
readln (str);
writeln (length (str) - pos (':', str));
end.
2)
var
str, s : string;
count, i : integer;
begin
readln (str);
s := copy (s, pos ('(', str) + 1, pos (')', str) - pos ('(', str) - 1);
count := 0;
for i := 1 to length (s) do
if s[i] = ' ' then inc (count);
writeln (count + 1);
end.
3)
var
str : string;
count : integer;
begin
readln (str);
count := 0;
while pos (',', str) > 0 do
begin
inc (count);
delete (str, pos (',', str), 1);
end;
writeln (str);
writeln (count);
end.
Сделано без проверки на соответствие условию.
var x,y,result: real;
begin
readln(x,y);
result:=cos(x)/pi-2*x+16*x*cos(x*y)-2;
writeln(result:7:4);
end.