Generation

generate functionMon, 21 Nov 2022

Write a program that takes 10 values from user, stores it in array and displays the number of even and odd numbers along with the number.

++ #include<iostream> using namespace std; void main() { int n,arr[10], even=0, odd=0; for(int i=0; i<10; i++) { printf("Enter the element: "); scanf("%d", &arr[i]); } for(int i=0; i<10; i++) { if(arr[i]%2==0) even++; else odd++; } printf("\nEven: %d", even); printf("\nOdd: %d", odd); }

Want to kickstart your project?Use the new AI Studio to create your code