Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

practiceIt: Exercise 6.2

+13 votes
when I enter this, "double percentEvens = (numEvens / numCount) * 100;" after my program has registered the number of evens and the count, it always gives me an output of 0.0%.....?
asked Jan 31, 2016 in (Winter 15-16) by Michelle Henry (100 points)

1 Answer

+4 votes
It looks like "integer division" strikes again...

What data type is numEvens?  What type of data is numCount?  Are they both integers?  If so, what happens when you divide them?
answered Feb 2, 2016 by Forrest Stonedahl (100 points)