WAP to add and subtract 2 numbers

WAP to add and subtract 2 numbers in c++

Add and Subtract using a function in c++

// WAP to add and subtract 2 numbers

#include<iostream>
using namespace std;

int main() {
	int a, b, add, sub;
	cout<<"Enter two numbers: \n";
	cin>>a>>b;
	add = a + b;
	sub = a - b;
	cout<<"\nSum: "<<add;
	cout<<"\nSub: "<<sub;
	return 0;
}

Output:

Enter two numbers:
4
3
Sum: 7
Sub: 1

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments