Var i,j,s,n:integer;
begin
readln(n);
for i := 1 to n-1 do
begin
s:=0;
for j := 1 to (i div 2) do
if i mod j=0 then s:=s+j;
if s=i then write(i,' ');
end;
end.
Var a, b, c, i:integer;
s:string;
begin
read (s);
for i:=1 to length(s) do if s[i]=' ' then delete(s,i,1);
write (s);
<span>end.
</span>var a, b, c, i:integer;
s, k:string;
begin
read (s);
k:='kk';
for i:=1 to length(s) do if s[i]=' ' then insert(k,s,i+1);
write (s);
<span>end.
</span>
var a, b, c, i:integer;
s:string;
begin
read (s);
for i:=1 to length(s) do if s[i]=',' then a:=i;
write (a);
end.
Благодарность не помешает.
<span>#include<span> <iostream>
</span>#include<span> <cstring>
</span>
int main() {
char* text1 = "Слово"<span>;
</span> char* text = "Как то текст с гласными на конце кок"<span>;
</span>
char* newText = new char[strlen(text)]<span>;
</span>
int lastStop = 0, lastIter = 0<span>;
</span> for (int i = 0; text[i] != '\0'; i++) {
bool copyIt = false<span>;
</span>
if (text[i] == ' ') lastStop = i<span>;
</span>
if (text[i + 1] == ' ' || text[i + 1] == '\0') {
for (int j = 0; text1[j] != '\0'; j++) {
if (text[i] == text1[j]) {
copyIt = false; break<span>;
</span> }
copyIt = true<span>;
</span> }
}
if (copyIt == true) {
for (int j = lastStop; j <= i; j++, lastIter++)
newText[lastIter] = text[j]<span>;
</span> }
}
for (int i = 0; i < lastIter; i++)
std::cout << newText[i]<span>;
</span>
std::cout << "\n"<span>;
</span>
return 0<span>;
</span>}</span>
Var
f: Text;
n, s, e: integer;
begin
n := 0;
s := 0;
Assign(f, 'input.txt');
Reset(f);
while not Eof(f) do
begin
readln(f,e);
n := n + 1;
s := s + e
end;
Close(f);
writeln('В файле ', n, ' чисел; их сумма равна ', s)
end.
Тестовое решение:
В файле 10 чисел; их сумма равна 213
Содержимое файла input.txt:
24
37
14
-6
42
58
3
14
0
27