First we make three objects and than input two objects and give the value of third object.
Code:
(i)How we can Plus in c++ Code:
#include <iostream>
using namespace std;
int main() {
int num1,num2,ans;
cout<<"Enter First number : ";
cin>>num1;
cout<<"Enter Second number : ";
cin>>num2;
ans= num1+num2;
cout<<"ANS : "<<ans;
}
(ii)How we can Subtract in c++ Code:
#include <iostream>
using namespace std;
int main() {
int num1,num2,ans;
cout<<"Enter First number : ";
cin>>num1;
cout<<"Enter Second number : ";
cin>>num2;
ans= num1-num2;
cout<<"ANS : "<<ans;
}
(iii)How we can Multiply in c++ Code:
#include <iostream>
using namespace std;
int main() {
int num1,num2,ans;
cout<<"Enter First number : ";
cin>>num1;
cout<<"Enter Second number : ";
cin>>num2;
ans= num1*num2;
cout<<"ANS : "<<ans;
}
(iv)How we can Divide in c++ Code:
#include <iostream>
using namespace std;
int main() {
int num1,num2,ans;
cout<<"Enter First number : ";
cin>>num1;
cout<<"Enter Second number : ";
cin>>num2;
ans= num1/num2;
cout<<"ANS : "<<ans;
}
0 Comments