Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int atodec(void) {
- char in[80];
- int i, len;
- printf("文字列を入力> ");
- fgets(in, 80, stdin);
- in[strlen(in) - 1] = '\0'; // remove new line
- len = strlen(in);
- for (i = 0; i < len; i++) {
- printf("%d", in[i]);
- if (i < len - 1) printf("_");
- }
- puts("");
- return len;
- }
- int main(void) {
- int len = atodec();
- printf("文字列は、%d 文字でした。", len);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement