Image caption Sales of Microsoft's Surface tablet were disappointing in the second quarter

Two of the world's biggest technology companies, Google and Microsoft, have badly missed earnings expectations for the second quarter.

Google reported profits of $9.7bn (£6.4bn), up 16% from a year ago but less than analysts were expecting.

Microsoft made $4.5bn in the second quarter, but announced that it would take a $900m charge relating to poor sales of its Surface tablet.

Shares in both companies fell by more than 4% in after-hours trading.

Declining PC sales - which recently saw their longest slide in five years - have hurt Microsoft's efforts to boost its business with the sale of its Windows 8 operating software.

Last week, the company also announced that it would cut the price of its Surface tablet amid sluggish sales.

More mobile

While Google's profits were up by more than 16% since last year, the company missed analyst expectations.

The main driver of Google's profits - advertising revenue - was up 15%.

More of Google's advertising revenues is coming from mobile adverts, which are cheaper.

While the company has been adapting, the change has hurt Google's bottom line.

Chief executive Larry Page said that adapting to mobile was a challenge the company was embracing.

"The shift from one screen to multiple screens and mobility creates tremendous opportunity for Google," he said.

On a conference call to discuss earnings, Mr Page mentioned the company's revamped AdWords programme, which has been well-received.