English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

which of the following terms will never evaluate to true for an initialized integer variable num?

a) (num%10 <=9)
b) (num%10 >=0)
c) (num%10 >9)
d) (num%10 ==0)

2007-02-25 08:06:08 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

The answer is C.

The % operator gives you the remainder when you divide one number by the other. Since num can only be an integer, the next highest remainder after 9 would be 10. You can't have a remainder of 10 if you're dividing by 10, because 10 would just go into the dividend one more time. In other words, 19 divided by ten is one with a remainder of 9, but 20 divided by 10 isn't one with a remainder of 10, it's just two.

2007-02-25 08:36:27 · answer #1 · answered by Geoffrey F 4 · 0 0

D. 10 is not equal to 0.

2007-02-25 16:10:31 · answer #2 · answered by Barkley Hound 7 · 0 1

fedest.com, questions and answers