US president's comments came after he was asked why North Korea can have nuclear weapons when Iran cannot.