Divisiblity of 5 without using % and / operator

后端 未结 9 2254
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 02:14

how to check whether a number is divisible by 5 or not without using % and / operator. I want a quickest algorithm for this problem.

9条回答
  •  有刺的猬
    2020-12-02 03:03

    bool trythis(int number){
      Int start = number;
      Do{
        start = start - 5;
      } while (start > 5)
    
      If (start == 5 || start == 0) {
        Return true;
      } else return false;
    }
    

提交回复
热议问题