6-3 统计个位数字 (15分)

int Count_Digit ( const int N, const int D )
{    
    int i,j,k;    
    int count=0;    
    if(N==0)        
        return 1;    
    else if(N<0)        
        j=-N;    
    else        
        j=N;    
    while(j) {
         i=j%10;       
         if(i==D)            
            count++;        
        j/=10;    
  }    
  return count;
}
发布了43 篇原创文章 · 获赞 13 · 访问量 1675

猜你喜欢

转载自blog.csdn.net/Angesthan/article/details/103687588