public boolean hasOne(int n) {
  int lastdigit=0;
  while( n >0 ){
    
    lastdigit=(n % 10);
    if(lastdigit==1) return true;
    n=n/10;
    
  }
  return false;
}

http://codingbat.com/prob/p191212

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-13
猜你喜欢
  • 2021-07-01
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2021-11-07
  • 1970-01-01
  • 2022-12-23
相关资源
相似解决方案