How do I find how many integers that equal 5 in an array

I know your probably getting tired of me by now but!
If I roll five dice and want to keep them for a score but only use how ever many fives are in the roll for the score. How would I go about doing this?
Thank you for you help!
Did you say that you are storing the dice roll values in an array?
You could do this:

1
2
3
int count=0, score=0;
for (i=0;i<5;i++) if theArray[i]==5 count++;
score=count*5;
@katielynnsdad
>> You should figure out how to count them without code, how to make algorithms, then write some code, otherwise you can not solve any problem by yourself. just try to do such a tasks by yourself. I am sure You can make it by yourself


I appreciate all the help but I got it figured out. Thanks again!
Topic archived. No new replies allowed.