Hi,
I made an application that could check integers between two values (by using spinedits) and then sum the total and display it on a richedit.
This is my code:
var iAnswer, iBase: Integer;
begin
iBase := 0;
for iAnswer := SpinEdit1.Value to SpinEdit2.Value do
begin
if ((iAnswer mod 2) = 0) then Inc(iBase, iAnswer);
end;
RichEdit1.Lines.Add('The sum of all the numbers is ' + IntToStr(iBase));
end;
It works great, except I want it to show me the even numbers and then the total e.g If I use 1 to 4, it must show: 2 + 4 = 6
Is this possible?
Thanks for your help :)
Regards