Skip to content

Instantly share code, notes, and snippets.

@phaya

phaya/round.c Secret

Last active December 22, 2015 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phaya/9ed685dea00d3c2f2981 to your computer and use it in GitHub Desktop.
Save phaya/9ed685dea00d3c2f2981 to your computer and use it in GitHub Desktop.
Me ponga como me ponga 1 partido por 2 es 0 en vez de 0.5 ¿cómo puede ser? ¿cómo lo modificarías para obtener el resultado correcto?
#include <stdio.h>
int main()
{
printf("%d\n", 1/2);
printf("%.2f\n", 1/2);
return 0;
}
@anacidoncha
Copy link

Esta última observación (un solo float) no la sabía. Tomo nota.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment