"4":
var num, sum:integer;
begin
sum := 0;
readln(num);
while num > 0 do
sum := sum + num mod 10;
num := num div 10;
end;
write(sum);
end.
"5":
var num:string;
save, j, i:integer;
check:boolean;
save:=0;
check := false;
for i:=1 to num.length do
for j:=1 to num.length do
if num[i] = num[j] then
check:=true;
save := i;
if check = true then
write('Figures repeat found ', num[save], ', performing the operation: ', check)
else
write('No recurring number was found. The outcome of the operation: ', check);
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
"4":
var num, sum:integer;
begin
sum := 0;
readln(num);
while num > 0 do
begin
sum := sum + num mod 10;
num := num div 10;
end;
write(sum);
end.
"5":
var num:string;
save, j, i:integer;
check:boolean;
begin
save:=0;
check := false;
readln(num);
for i:=1 to num.length do
for j:=1 to num.length do
if num[i] = num[j] then
begin
check:=true;
save := i;
end;
if check = true then
write('Figures repeat found ', num[save], ', performing the operation: ', check)
else
write('No recurring number was found. The outcome of the operation: ', check);
end.