App crashes during calculation loop

Hello,
This is a simple app as a school project to calculate the greatest common divisor of two numbers. The problem is that the app always crashes when it is supposed to calculate and I don't know what the reason is.
Maybe someone can help me.

ggT_Rechner.aia (138.0 KB)

This is the original blocks..


Look at the else if...then you are setting number1 to number2-number1. It should be number2 to number2-number1
Corrected blocks:

Your algorithm looks good. However I highly recommend Euclid's Division algorithm (If you now about it). It's waaaay better for big numbers.

oh, thank you :slight_smile:
That was easier than I thought, sorry for bothering you

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.