🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.pow() does not exist in C
  2. B.pow() only works for squares
  3. C.pow() works in double, and rounding (like 124.999…) can become a wrong int
  4. 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 →