I'm trying to convert the ASCII values of each letter, into Binary but I'm not sure how to grab the decimal values and convert them. Here's the code that prints out a word with their ASCII values to the right
#include <stdio.h>
#include <string.h>
int main (void) {
char c[20];
printf("Enter a word: ");
scanf("%s",&c);
int i;
char *str = c;
int length = strlen(str);
for (i = 0; i < length; i++) {
printf("%c = %d \n", str[i] , str[i]);
}
return 0;
}
Example output:
Enter a word: Program
P = 80
r = 114
o = 111
g = 103
r = 114
a = 97
m = 109