Maximum gcd pair

sir i am practicing a question related to gcd . but i am getting an error i dont understand. so please tell my error and help me complete my code .

question - https://practice.geeksforgeeks.org/problems/maximum-gcd-pair3534/1/?category[]=sieve&category[]=sieve&page=1&query=category[]sievepage1category[]sieve#

my code - https://ide.codingblocks.com/s/472148

hello @tejuschaturvedi0

the logic is not correct.picking smallerst and largest number doesnt ensure maximum gcd.

refer this for all valid approaches and their implementation->link