CPP
#include <iostream>
int main()
Try it Yourself ➠
C++ program using Assignment Operator
11 May
0
Write a program (WAP) in C++ to read two numbers from keyboard(User Input) and perform addition, subtraction, multiplication and division using assignment operator.
#include <iostream>
using namespace std;
int main()
{
int num1, num2, sum, sub, mul;
float div;
cout<<"Enter two integers\n";
cin>>num1>>num2;
sum = num1 + num2;
sub = num1 - num2;
mul = num1 * num2;
div = num1 / (float)num2;
cout<<"Addition = "<<sum<<"\n";
cout<<"Subtraction = "<<sub<<"\n";
cout<<"Multiplication = "<<mul<<"\n";
cout<<"Division = "<<div<<" \n";
return 0;
}
Try it Yourself ➠
Must Read :-
Previous article
Next article
Leave Comments
Post a Comment