שאלה 7 , א+ב פתרון בפסקלית:
קוד:
function bigSums(a:integer):integer;
var sum,as,ah,I,J,k:integer;
begin
ah:=a mod 10;
as:=a div 10;
if (ah > as) then
begin
I:=ah;
J:=as;
end
else
begin
I:=as;
J:=ah;
end;
sum:=0;
For K:=J to I do
sum:=sum+K;
bigSums:=sum;
end;
count:=0;
For I:=1 to 23 do
begin
if (bigSums(A) > 15) then
count:=count+1;
end;
writeln(count);