Question about something that I don't understand how to overcome it

In my program I had added 2 Text Fields, in which user has to type only natural numbers. My program in simulator finds something but only for the first pair of natural numbers, than after typing there another pair of numbers it will print the same previous answer if it would be the same app launch. How can I make app to print suitable answer for any pairs of numbers in any case(i.e. if it’s in one launch or more than one)?
For example: Now this app printed correct answer


but if I would type another pair without launching this app again on the simulator it will print the same answer.

It’s really not possible to say what the problem is without seeing some code.


That’s all code.

The way you have your ViewController class set up, you are only calculating the values of x1, y1, and z1 once. You need to recalculate them every time the user enters new numbers or taps or whatever.

So when the user triggers your enterTapped method, you should run your GCD function to calculate the values based on what is currently in the text fields.