Skip to content

Instantly share code, notes, and snippets.

@pureexe
Created May 20, 2013 15:22
Show Gist options
  • Select an option

  • Save pureexe/5612913 to your computer and use it in GitHub Desktop.

Select an option

Save pureexe/5612913 to your computer and use it in GitHub Desktop.
แปลงตัวอักษรเปนเลขฐาน2
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
int main()
{
char word[200];
gets(word);
char buff[20];
int i,x;
for(i=0;i<strlen(word);i++){
itoa(word[i],buff,2);
x=strlen(buff);
while(x<8)
{
printf("0");
x++;
}
printf("%s\t",buff);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment