Konversi C ke Phyton
#include <stdio.h>
#include <string.h>
int mylen(char *n);
int mylen(char *n)
{
int count=0;
for(int i=0; n[i]!='\0'; i++){
count++;
}
printf("count=%d",count);
return count;
}
int main(void){
char name[20];
printf("enter name:\n");
scanf("%s",&name);
puts(name);
int len = mylen(name);
printf("length = %d",len);
return 0;
}
Odd Owl