| Бейсик | Python |
|---|---|
| DIM N AS LONG DIM R, d AS INTEGER INPUT N R = 0 WHILE N > 0 d = N MOD 10 IF d <> 4 THEN R = R + d END IF N = N \ 10 WEND PRINT R END | N = int(input()) R = 0 while N > 0: d = N % 10 if d != 4: R = R + d N = N // 10 print(R) |
| Алгоритмический язык | Паскаль |
| алг нач цел N, R, d ввод N R := 0 нц пока N > 0 d := mod(N, 10) если d <> 4 то R := R + d все N := div(N, 10) кц вывод R кон | var N: longint; R, d: integer; begin readln(N); R := 0; while N > 0 do begin d := N mod 10; if d <> 4 then R := R + d; N := N div 10; end; writeln(R); end. |
| С++ | |
| #include <iostream> using namespace std; int main() { long int N; int R, d; cin >> N; R = 0; while (N > 0) { d = N % 10; if (d != 4 ) { R = R + d; } N = N / 10; } cout << R << endl; return 0; } |
Ответ: