Donald Trump has been elected the 47th president of the United States after high pitched battle of US election ends.