Pergunta de entrevista da empresa Pocket Gems

Round a floating point number to the nearest integer. Do not use any helper functions.

Resposta da entrevista

Sigiloso

21 de fev. de 2012

int round(float input) { int x = ( input > 0 ) ? (input + 0.5):(input - 0.5) ; return x ; }

1