Your first if-statemant will set t to 0 if you reach your last Array (in your case the 10th array).
But after this if-statement (and the second one) is completed your for-loop will start a new iteration. On each iteration your loop increments t by 1 (because of t++).
This means t - which was previously set to “0” - will now be incremented to be"1".
Setting t inside your if-statement to be “-1” sould do the trick.
I will just write the logic you have to use, as I am sure you will be able to code it.
So the problem asks to find the smallest common multiple (or LCM) of two numbers which are also divisible by all numbers between the two numbers.
one way to do it is to find the bigger of the two numbers, and find a number that is divisible by the bigger number and (bigger number)-1 (call it x) (it should always be (bigger number)(x) since they are both relative primes). call this answer as y
next you decrement x, and find out if x (bigger number-2) is divisible by y. If it is then decrement x and check if it is divisible by y. if you reach a point where x isint divisible, then y =yx, and continue the decrementing.
Do this until x ==smaller number
I hope you are able to understand this, as I am not the best in explaining logic.