Responsive Advertisement

Assignment Operators in Hindi

Assignment Operators in Hindi
Assignment Operators के लिए '=' operator का इस्तेमाल किया जाता है |
Assignment Operators पांच प्रकार के होते है |
OperatorsFor ExampleDescription
=a = bAssignment Operator
+=a += b or a = a + bAdd Assignment Operator
-=a -= b or a = a - bSubtract Assignment Operator
*=a *= b or a = a * bMultiply Assignment Operator
/=a /= b or a = a / bDivide Assignment Operator
%=a %= b or a = a % bModulus Assignment Operator

Example = (Assignment Operator)

Source Code :
123456<?php
$a = 5;
$b = $a;
echo "Value of a : ".$a. "<br />";
echo "Value of b : ".$b;
?>
Output :
Value of a : 5
Value of b : 5

Example += (Add Assignment Operator)

Source Code :
123456<?php
$a = 5;
$b = 10;
$a += $b; // a = a + b;
echo "Value of a : ".$a;
?>
Output :
Value of a : 15

Example -= (Subtract Assignment Operator)

Source Code :
123456<?php
$a = 5;
$b = 10;
$a -= $b; // a = a - b;
echo "Value of a : ".$a;
?>
Output :
Value of a : -5

Example *= (Multiply Assignment Operator)

Source Code :
123456<?php
$a = 5;
$b = 10;
$a *= $b; // a = a * b;
echo "Value of a : ".$a;
?>
Output :
Value of a : 50

Example /= (Divide Assignment Operator)

Source Code :
123456<?php
$a = 5;
$b = 10;
$a /= $b; // a = a / b;
echo "Value of a : ".$a;
?>
Output :
Value of a : 0.5

Example %= (Modulus Assignment Operator)

Source Code :
123456<?php
$a = 5;
$b = 10;
$a /= $b; // a = a % b;
echo "Value of a : ".$a;
?>
Output :
Value of a : 5

Post a Comment

0 Comments