Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void){
- int decimal,binary,position;
- //decimal = 76;
- position = 1;
- binary = 0;
- printf("Enter decimal number: ");
- scanf("%d",&decimal);
- while (decimal > 0){
- binary += (decimal % 2) * position;
- decimal /= 2;
- position *= 10;
- }
- printf("%d",binary);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement