Answer to Question #215114 in C++ for bila

Question #215114

Write

a

program

in C++ to

display all ‘N’

arithmetic means between the consecutive elements of the

sum of Concatenated and Multiplexed versions of A1[R]

and A

2[R] entered by

a

user.



1
Expert's answer
2021-07-09T00:47:24-0400
using namespace std;
#include <omp.h>
#include <stdio.h>


/*
	Write a program in C++ to display all ‘N’ arithmetic means between the consecutive elements of the
	sum of Concatenated and Multiplexed versions of A1[R] and A 2[R] entered by a user.
*/


#define R	5
main(void)
{
//	int A1[R], A2[R];
	float A1[R] = {2, 4, 7, 9, 10};
	float A2[R] = {3, 8, 11, 10, 11};
	int n,m;
	float a,b,AM;


	cout<<"\nA1["<<R<<"] = ";	for(m=0;m<R-1;m++) cout<<A1[m]<<", "; cout<<A1[R-1];
	cout<<"\nA2["<<R<<"] = ";	for(m=0;m<R-1;m++) cout<<A2[m]<<", "; cout<<A2[R-1];
	
	cout<<"\n\nConcatenated Array: ";
	for(m=0;m<R;m++) cout<<A1[m]<<", ";
	for(m=0;m<R-1;m++) cout<<A2[m]<<", ";
	cout<<A2[R-1];
				
	
	cout<<"\n\nContinuous elements:";
	for(m=0;m<R;m++)
	{
		a = A1[m];
		for(n=0;n<R;n++)
		{
			if(a+1 == A2[n]) 
			{
				AM = (a + A2[n])/2;
				cout<<"\nA1["<<m<<"] = "<<A1[m]<<"\tA2["<<n<<"] = "<<A2[n]<<"\tArithmatic Mean = "<<AM;
			}
		}
	}
	
}

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