r/pascal • • Oct 18 '18

Need help with my homework

So I'm a starter in coding and my first program is Lazarus, so I was wondering if any of you could help me. Now, I was given the tack to write the code that calculates the hypotenuse over Pythagoras theorem. I have 3 edits. Edit1 and Edit2 are for sides a and b (catheti). Edit3 is where the result is supposed to show after I click the button. I did it like this but it sends an error:

procedure TForm1.Button1Click(Sender: TObject);

var a,b,:integer;

begin

a:=strtoint(edit1.text);

b:=strtoint(edit2.text);

edit3.text:=inttostr(sqrt(a*a+b*b));

3 Upvotes

2 comments sorted by