солнвшко
18.05.2022 02:49

решить. Нужно сделать в паскале

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
айлимайли
20.01.2020 13:11

var


 i, si, N, ss: Integer;


 s: string;


begin


   Write ('Введите N: ');


   ReadLn (N);


   s := IntToStr (N);


   ss := 0;


   for i := 1 to Length (s) do begin


     si := StrToInt (s [i]);


     if si mod 4 <> 0 then


       ss := ss + si;


   end;


   Writeln ('Сумма цифр = ' + IntToStr (ss));


end.

// второй вариант решения

var

si, N, ss: Integer;

begin

Write ('Введите N: ');

ReadLn (N);

ss := 0;

while N > 0 do begin

si := N mod 10;

N := N div 10;

if si mod 4 <> 0 then

ss := ss + si;

end;

Writeln ('Сумма цифр = ' + IntToStr (ss));

end.

0,0(0 оценок)
Ответ:

program s1;

uses

 SysUtils;

var

 s, t: string;

 i: Integer;

 c: string;

begin

 Write ('Введите строку: ');

 ReadLn (s);

 t := '';

 for i := 1 to Length (s) do begin

   if s [i] in ['a'..'z'] then

     c := IntToStr (Ord (s [i]) - Ord ('a') + 1)

   else if s [i] in ['A'..'Z'] then

     c := IntToStr (Ord (s [i]) - Ord ('A') + 1)

   else if s [i] = ' ' then

     c := '0'

   else

     c := s [i];

   t := t + c + ' ';

 end;

 WriteLn (t);

 ReadLn

end.

program s2;

uses

 SysUtils;

var

 s, t: string;

 i: Integer;

 c: string;

begin

 Write ('Введите строку: ');

 ReadLn (s);

 t := '';

 for i := 1 to Length (s) do begin

   if not (s [i] in ['e', 'y', 'u', 'i', 'o', 'a', 'E', 'Y', 'U', 'I', 'O', 'A']) then

     c := s [i]

   else

     c := '';

   t := t + c;

 end;

 WriteLn (t);

 ReadLn

end.

0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота