Answer to Question #311911 in C++ for Minie

Question #311911

Enter a C++ program that will help accept an input for the array size. Store the user input then display the even odd numbers.



Enter array size :: 10



Enter array elements ::



Enter arr[0] Elements :: 1


Enter arr[1] Elements :: 2


Enter arr[2] Elements :: 3


Enter arr[3] Elements :: 4


Enter arr[4] Elements :: 5


Enter arr[5] Elements :: 6


Enter arr[6] Elements :: 7


Enter arr[7] Elements :: 8


Enter arr[8] Elements :: 9


Enter arr[9] Elements :: 0



Stored Data in Array ::


1 2 3 4 5 6 7 8 9 0



Events Elements in Array are ::


2 4 6 8 0



Odd Elements in Array are ::


1 3 5 7 9

1
Expert's answer
2022-03-15T05:54:14-0400


#include <iostream>
using namespace std;




int main() {
	int size;
	int numbers[1000];
	cout<<"Enter array size :: ";
	cin>>size;
	cout<<"Enter array elements ::\n";
	for(int i=0;i<size;i++){
		cout<<"Enter arr["<<i<<"] Elements :: ";
		cin>>numbers[i];
	}
	cout<<"Stored Data in Array ::\n";
	for(int i=0;i<size;i++){
		cout<<numbers[i]<<" ";
	}
	cout<<"\nEvents Elements in Array are ::\n";
	for(int i=0;i<size;i++){
		if(numbers[i]%2==0){
			cout<<numbers[i]<<" ";
		}
	}
	cout<<"\nOdd Elements in Array are ::\n";
	for(int i=0;i<size;i++){
		if(numbers[i]%2!=0){
			cout<<numbers[i]<<" ";
		}
	}


	cin>>size;
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment