How many Odd and Even number are the in a array

后端 未结 3 533
抹茶落季
抹茶落季 2020-12-20 10:52

I have created an Array with some numbers. I want to find out how many even, and how many odd numbers it is in this Array. I have to print it out like this: (this is j

3条回答
  •  孤城傲影
    2020-12-20 11:23

    You always add the complete Length of the array to your variable

    Try this instead of sumPar += arr.length;:

    sumPar++;
    

提交回复
热议问题