Answer to Question #212591 in C++ for Kefilwe Mamabolo

Question #212591

Upon calling the function display the average determined by the user-defined function


1
Expert's answer
2021-07-02T04:09:53-0400
#include<iostream>
using namespace std;
float average(int first, int second){
	return (first + second) / 2;
}
int main(){
	int first, second;
	cout<<"Enter the first element: \t"<<endl;
	cin>>first;
	cout<<"Enter the second element: \t"<<endl;
	cin>>second;
	cout<<"The first element is: \t"<<first<<"\nThe second element is:\t"<<second<<endl;
	cout<<"The average is:\t"<<average(first,second);
}

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