Last active
December 16, 2019 23:14
-
-
Save parzibyte/acc02a63630b35e81408fa6c0c51213d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
// El número que el usuario va a ingresar | |
long decimal = 0; | |
// Una cadena de máximo 63 bits, o sea longitud 63 | |
char cadena[63]; | |
printf("Ingresa un numero decimal:\n"); | |
scanf("%llu", &decimal); | |
/* | |
ltoa e itoa no regresan nada; modifican directamente a la variable | |
El último argumento es la base: 2 en este caso | |
*/ | |
ltoa(decimal, cadena, 2); | |
printf("El numero en binario es: %s\n", cadena); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment