#include<stdio.h>
#include<string.h>
int main(){
unsigned int n;
while(scanf("%d",&n)!=EOF){
char arr[20];
int total=0;
sprintf(arr,"%d",n);
int a;
a=strlen(arr);
printf("%d\n",a);
for(int i=0;i<a;i++){
switch(arr[i]){
case '0':
total+=1;
break;
case '6':
total+=1;
break;
case '8':
total+=2;
break;
case '9':
total+=1;
break;
default:
break;
}
}
printf("%d\n",total);
}
} 可以幫我找出原因嗎
#include
#include
int main(){
unsigned int n;
while(scanf("%d",&n)!=EOF){
char arr[20];
int total=0;
sprintf(arr,"%d",n);
int a;
a=strlen(arr);
printf("%d\n",a);
for(int i=0;i
switch(arr[i]){
case '0':
total+=1;
break;
case '6':
total+=1;
break;
case '8':
total+=2;
break;
case '9':
total+=1;
break;
default:
break;
}
}
printf("%d\n",total);
}
} 可以幫我找出原因嗎剛剛把%d改成%u就過了,可惡阿