ITPub博客

首页 > > > hasOne

hasOne

作者:友哥 时间:2017-02-15 21:05:00 0 删除 编辑
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

 

原文作者:;如有侵权,请联系管理员删除。

上一篇: 气质
请登录后发表评论 登录
全部评论

注册时间:2020-05-20

  • 博文量
    276
  • 访问量
    1000