Determining if a number is either a multiple of ten or within a particular set of ranges

后端 未结 13 1568
Happy的楠姐
Happy的楠姐 2021-01-31 07:01

I have a few loops that I need in my program. I can write out the pseudo code, but I\'m not entirely sure how to write them logically.

I need -

if (num is          


        
13条回答
  •  情深已故
    2021-01-31 07:11

    You basically explained the answer yourself, but here's the code just in case.

    if((x % 10) == 0) {
      // Do this
    }
    if((x > 10 && x < 21) || (x > 30 && x < 41) || (x > 50 && x < 61) || (x > 70 && x < 81) || (x > 90 && x < 101)) {
      // Do this
    }
    

提交回复
热议问题