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.
65(8)=53(10)< 53(7)=38(10)
Боря из Омска
Витя из Москвы
Гриша из Санкт-Петербурга
Егор из Кирова
Думаю так
#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL, "RUSSIAN");
string str1;
int count=0;
cout << "Программа подсчета количества букв \"к\" строке" << endl;
str1 = "Строка";
for (int i = 0; i < str1.length(); i++)
if (str1[i] == 'к')
count++;
cout << "Буква встречается в строке " << count << " раз" << endl;
system("pause");
}
Ответ:
18
Объяснение:
Проверено в Xsel
Выбираешь через шифт ячейки от B12 по В17 и считаешь
Получается 3 колонки, 6 строчек, умножаешь и получаешь 18