rem %= Variable rem = (remainder) <Html> <Head> <Title>Demo Program - To test Arithmetic Shorthand Operators in JavaScript </Title> </Head> <Html> <Head> <Title>Demo Program - To test Arithmetic Shorthand Operators in JavaScript </Title> </Head> <Body> <script language="javascript" type="text/javascript"> var value1 = , value2= ; document.write("<br>Data1 : "+value1); document.write("<br>Data2 : "+value2); var sum = value1; sum+=value2; var diff = value1; diff-=value2; var prod = value1; prod*=value2; var res = value1; res/=value2; Illustration . Using Arithmetic Shorthand Operators Chapter Pages var rem = value1; rem%=value2; document.write("<br><br>The Sum of Data1 and Data2 Using += : "+sum); document.write("<br>The Difference of Data1 and Data2 Using -= : "+diff); document.write("<br>The Product of Data1 and Data2 Using *= : "+prod); document.write("<br>The Result after Division of Data1 and Data2 using /= : "+res); document.write("<br>The Remainder after Division of Data1 and Data2 Using %= : "+rem); </script> </Body> </Html> Output: Assignment: Develop JavaScript code for the following: . To find Simple Interest for the given Principle, Number of years and Rate of interest. .
To find Compund Interest for the given Principle, Number of years and Rate of interest. . To find difference between Simple Interest and Compound Interst. .
. Relational or Comparison Operators: Relational operators are also called as Comparison operators, they compares two values and the result is true or false. JavaScript provides a rich set of relational operators including == (equal to), != (not equal to), < (less than), > (greater than), <= (less than or equal to), and >= (greater than or equal to). Using a relational operator in an expression causes the expression to evaluate as true if the condition holds or false if otherwise.
Table: . Relational or Comparison operators Relational (Comparison) Operator Meaning Example Result Assume x= and y= == Equality x==y False != In-equality x!=y True < Less-than x<y True > Greater-than x>y False <= Less-than or equal to x<=y True >= Greater-than or equal to x>=y False Chapter Pages <Html> <Head> <Title>Demo Program - To test Relational(Comparison) Operators in JavaScript </Title> </Head> <Body> <script language="javascript"