/*decimal to binary*/
#include <stdio.h>
void printBinary(const unsigned char val) {
for(int i = 7; i >= 0; i--)
if(val & (1 << i))
printf("1");
else
printf("0");
printf("\n");
}
int main() {
int dec;
int hold=0;
printf("Integer number : ");
scanf("%d",&dec);
printBinary((unsigned char)dec);
}
Hiroshe commented: 1. Don't give away free code. 2. That code is bad. -1
Salem commented: I couldn't give a shit about the code if you can't be arsed to use code tags. -7
ambarisha.kn 15 Junior Poster in Training
ambarisha.kn 15 Junior Poster in Training
Salem commented: Well done! +23
ambarisha.kn 15 Junior Poster in Training
ambarisha.kn 15 Junior Poster in Training
ambarisha.kn 15 Junior Poster in Training