text: The ministers gave their opinion in a statement released at the end of a two-day meeting of G20 nations in China.
  Chancellor George Osborne, who is at the event, told the BBC the referendum issue was "deadly serious".
  But former Chancellor Lord Lawson said the G20's warning was "absurd" because 15 of its members were outside the EU.
  Asked if he or his officials had asked for the warning to be included in the statement, Mr Osborne said: "We've got countries around the table like the United States of America, like the IMF, like the Chinese who frankly don't do what anyone tells them to do."
  However, Lord Lawson told the BBC: "The British people will not take kindly to being told by the G20 what they should do. And the notion that the UK leaving the EU would cause an economic shock is absurd.
  "Fifteen of the members of the G20 are outside the EU, and that hasn't caused an economic shock. Indeed, most of them are doing better than most of the members of the European Union."
  The UK's EU referendum: All you need to know
  EU vote: Where the cabinet and other MPs stand
  EU reform deal: What Cameron wanted and what he got
  UKIP leader Nigel Farage said the G20 announcement was "no surprise" as it was "mates helping each other out".
  "I'm not surprised that big government gets together to support David Cameron," he added.
  "This is big banks, big business, big government all scratching each other's backs. I don't think that impresses voters."
  Officials travelling with Mr Osborne say the mention of the UK's referendum in the G20 meeting's final communique is unusual. Mr Osborne has denied he pushed for it.
  The chancellor told the BBC: "The financial leaders of the world's biggest countries have given their unanimous verdict and they say that a British exit from the EU would be a shock to the world economy.
  "And if it's a shock to the world economy imagine what it would do to Britain."
  He added: "This isn't some adventurous journey into the unknown, with all the humour attached to it, this is deadly serious."
  With the gleaming early spring sunshine behind him, as he stood on the bank of Shanghai's Huangpu river, the chancellor said he was "deadly serious".
  He's not the only one. It seems the other 19 leaders at the G20 agree about the "shock", as they've called it, if the UK walked out of the EU.
  It's not a big surprise. The president of hosts China made it clear last year during his Chequers stay that he wants Britain In.
  But then again China doesn't really do intervention in domestic politics.
  George Osborne will be pleased to have this significant and very public diplomatic backing as he sits on the plane back home tonight.
  There's a whiff of the Scottish referendum campaign about it though, when various foreign leaders lined up behind the government position.
  A senior official from the Treasury told the BBC the chancellor's US counterpart had raised the issue during the meeting, as did others, including senior Chinese officials and Ms Lagarde.
  US Treasury Secretary Jacob Lew later urged UK voters to "consider the impact" of voting to leave, and said the White House believed it was in the UK's "national security interests" to remain in the union.
  Elsewhere, Prime Minister David Cameron was in Northern Ireland as part of his UK tour to persuade voters that membership of a reformed EU is in their best interests.
  CBI director general Carolyn Fairbairn described the potential consequences of the UK leaving the EU as an "evident risk".
  "Those who wish to leave must put forward a clear economic case, explaining how being outside the EU will enhance jobs, growth and prosperity in the UK and across Europe.
  "The majority - but not all - of CBI members want the UK to remain in a reformed EU," she added.
  Meanwhile, London Mayor Boris Johnson has clarified his position over the idea that a vote to leave the EU could force Brussels to give Britain a better deal over its membership and trigger a second referendum.
  Mr Johnson had previously suggested that only by voting to leave would the UK "get the change we need".
  But in The Times, Mr Johnson stated categorically: "Out is out".
  The UK will vote on whether to leave or remain in the EU on 23 June.
  Mr Cameron set the date last weekend after agreeing a deal with fellow EU leaders about a renegotiation of the UK's EU membership.
target: Finance ministers from the world's leading economies have warned of a "shock" to the global economy if the UK leaves the EU.