Answer to Question #315520 in C++ for nickname

Question #315520

This is another easy exercise to test your knowledge of the fundamentals. In main(), ask the user to enter two integers. Pass those two integers to a function that will subtract one number from another. This function must also output the answer to the user.

 

Output:

 

Enter two integers (separated by a space) and this program will subtract them:   [user enters: 5 7]

5 - 7 = -2


1
Expert's answer
2022-03-22T09:07:48-0400
void Sum(int a,int b)
{
        cout << "Enter two integers" << endl;
		cin >> a >> b;
		cout << a << " - " << b << " = " << a - b << endl;
}
int main()
{
	int a,b;
		Sum(a,b);
}

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