Answer to Question #348557 in C++ for Hasnat

Question #348557

Create an array of size 15. Multiply even values of array with 3 and place them in the array

1
Expert's answer
2022-06-09T09:58:53-0400
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int arr[15];
	cout << "Please, enter elements of array: ";
	for (int i = 0; i < 15; i++)
	{
		cin>> arr[i];
	}
	for (int i = 0; i < 15; i++)
	{
		if(i%2==0)
			arr[i]=arr[i]*3;
	}
	cout << "Changed array: ";
	for (int i = 0; i < 15; i++)
	{
		cout<<arr[i]<<" ";
	}
}

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

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS