Assignment Operators +=

a+=b is short-hand for a=a+b
(though note that expression a will only be evaluated once)

or in another form

+= is a compound assignment operator – it adds the RHS operand to the existing value of the LHS operand

We are displaying examples in multiple languages: c, Python, PHP and Java

Example in Python Language

a = a
a += 3

print( “Output \nAssignment Operator:” . str(a) )

Example Assignment Operators += in Python
Example Assignment Operators += in Python
Example Assignment Operators += in Python



Example in Java Language

public class frequenTech{

private static int i=3;
public static void frequenTech(){

i += 5;
System.out.println(“Output \nAssignment Operators:”+i);

}
public static void main(String[] args){
frequenTech();
}

}

Example Assignment Operators += in Java
Example Assignment Operators += in Java
Example Assignment Operators += in Java



Example in C Language

#include <stdio.h>
int i;
void main(){
i=3;
i+=4
printf(“Output: \nAssignment Operators %d”, i);
}

Example Assignment Operators += in C Language
Example in C LanguageExample Assignment Operators += in JavaExample in C Language



Example in PHP

$i = 3;

$i +=2;
echo “Output <br /> Assignment Operators:”.$i;

Example Assignment Operators += in PHP
Example Assignment Operators += in PHP
Example Assignment Operators += in PHP
Grover Harleen

Grover Harleen

Harleen Grover is running a growing web and mobile development company. He always focuses to learn something new and grow and share his knowledge with others same time. you can send him your questions also related to programming and Technology and He will always try to provide the Best outputs to you.

Leave a Reply

Your email address will not be published. Required fields are marked *