← Quiz: Number Programs in C: all 10 questions
Quiz: Number Programs in C · Question 6 of 10
Why should a C program avoid pow() when checking Armstrong numbers?
Why should a C program avoid pow() when checking Armstrong numbers?
- A.pow() does not exist in C
- B.pow() only works for squares
- C.pow() works in double, and rounding (like 124.999…) can become a wrong int
- D.pow() is slower than a loop for every input
Answer & explanation
Correct answer: pow() works in double, and rounding (like 124.999…) can become a wrong int
Whole-number problems should use whole-number arithmetic to avoid rounding errors.
Can you get the rest right without peeking?
Take the timed Quiz: Number Programs in C quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →