Pages

Wednesday, 21 February 2018

Assignment Operators Example in C++ Programming Language

Assignment Operators Example in C++ Programming Language

#include <iostream>
using namespace std;
int main(){
 int num1 = 240;
 int num2 = 40;
 num2 = num1;
 cout<<"= Output: "<<num2<<endl;
 num2 += num1;
 cout<<"+= Output: "<<num2<<endl;
 num2 -= num1;
 cout<<"-= Output: "<<num2<<endl;
 num2 *= num1;     
 cout<<"*= Output: "<<num2<<endl;
 num2 /= num1;     
 cout<<"/= Output: "<<num2<<endl;
 num2 %= num1;     
 cout<<"%= Output: "<<num2<<endl;
 return 0;

}