0

Can anyone tell me a C++ Program to print total no. of even and odd elements in an array?

I want a c++ program to print the total number of even and odd elements entered in an array For example int arr[2,3,4,5,6] Output= No. of Even numbers=3 No. of Odd numbers=2

31st Aug 2019, 5:27 PM
M Shehryar Khan
M Shehryar Khan - avatar
5 Respuestas
+ 2
I can only tell write about logic : int even, odd for(int i=0;i<5;i++){ if( arr[i] %2==0) even++ else odd++
31st Aug 2019, 5:31 PM
Abhishek Kushwaha
Abhishek Kushwaha - avatar
0
Yeah i know this logic but i want to print the total numbers of both even and odd numbers in the array.That's the problem for me
31st Aug 2019, 5:33 PM
M Shehryar Khan
M Shehryar Khan - avatar
0
Post your code, so that we could help you with a little tweak
31st Aug 2019, 5:36 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
Thanks Happy to Help but can we do it without using the function?
31st Aug 2019, 5:38 PM
M Shehryar Khan
M Shehryar Khan - avatar
0
Ok Thanks All.
31st Aug 2019, 5:43 PM
M Shehryar Khan
M Shehryar Khan - avatar