#include <stdio.h>
int convert(int n, char str[],char ch);
int main()
{
int a;
scanf("%d",&a);
int cont;
char c[100];
char ch;
getchar();
scanf("%c",&ch);
cont=convert(a,c,ch);
printf("%d",cont);
return 0;
}
int convert(int n, char str[],char ch)
{
int k=0,i,j;
int cont=0;
if(n==0)
printf("0");
while(n!=0)
{
j=n%16;
n/=16;
str[k]="0123456789abcdef"[j];
k++;
}
str[k]='\0';
for(i=0;i<k;i++)
if(str[i]==ch)
cont++;
return cont;
}
不知道哪里出问题了🥲😥
欢迎讨论和更正;