Код c/c++: #include < iostream> int main() { int a, count; std: : cin> > a; for(int i = 0; i < 100; ++i) { if(a > 10) { count += a%10; a/=10; } else { count+=a; break; } } std: : cin> > "\n"> > count; return 0; }
bugaevnicky
02.08.2020
var a, b : integer; procedure fo(a, b: integer); var i : integer; begin for i: =a to b do write(i,' '); writeln('n = ',b-a+1); end; procedure whil(a, b : integer); var n: integer; begin n: =0; while (a < = b) do begin write(a,' '); inc(a); inc(n); end; writeln('n = ', n); end; procedure repea(a, b : integer); var n : integer; begin n: =0; repeat write(a,' '); inc(a); inc(n); until (a> b); write('n = ',n); end; begin readln(a, b); fo(a, b); whil(a, b); repea(a, b); end.