Answer to Question #219460 in C++ for strawberry

Question #219460
  1. Develop a program to display the multiplication table for any numbers key in by the user, define the loop to display the multiplication process in a function.
  2. Define a function to find out the minimum, maximum, and mean values in the array of 10 numbers.
1
Expert's answer
2021-07-21T16:33:38-0400
#include<iostream>
using namespace std;
void multiplicationTable(int n){
	cout<<"The multiplication table for "<<n<<" is:\n";
	for(int i=0; i<=12; i++){
		cout<<n <<" x "<< i<<" = "<<i * n<<endl;
	}
}
void minMaxMean(int arr[10]){
	double sum = 0.0;
	int min = arr[0];
	int max = arr[0];
		for(int i=0; i<10; i++){
		sum += arr[i];
		}
	for(int i=0; i<10; i++){
		
		
		
	}
	for(int i=1; i<10; i++){
		if(arr[0] < arr[i]){
			max = arr[i];
		}
	}
	for(int i=0; i<10; i++){
	if(arr[0] > arr[i]){
			min = arr[i];
		}	
	}
	cout<<"The minimimum is: \t"<<min<<"\nThe maximum is: \t"<<max<<"\nThe mean is:\t"<<sum /10 <<endl;
} 
int main(){
	int arr[10] = {20,30,10,40,50,60,5, 70,80,120};
	minMaxMean(arr);
	int n;
	cout<<"Enter a number to display its multiplication table\n";
	cin>>n;
	multiplicationTable(n);
}

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
APPROVED BY CLIENTS