Hi, in this tutorial I will tell you how you can do math calculations with wapka :math: tag. You will find this tutorial very helpful if you are willing to do calculations without any JavaScript.
With wapka :math: tag you can add, subtract, divide, multiplication very easily without need of any external languages like JavaScript. So no need to use JavaScript means that al users via Phone or PC will see your math calculations. Lets do some basics in this tutorial. I will also add the calculator tutorial with some advance options you ever seen on wapka.
First, you should understand the :math: tag in wapka. math tag starts with :math: and ends on :/math: so your calculations should be between :math: and :/math: tags. Outside of these tags math calculations will not work.
If you want that your answer should b e in decimal points, than you can start your math tag as :math,DEC: (You can change DEC with the number of decimal points you want in result for example: 2 or 3, even 5).. Now if we want 2 decimal then our code should look like this
Now instead of CALCULATIONS you can do following calculation or as you like.
1. Subtraction: You can subtract two numbers. Like
For this purpose you can use - sign.
2. Multiplication: You can multiply two or more digits to get the answer. See example below
or
3. Addition: You can add two or more numbers.
For this purpose you can use + sign.
4. Division: You can divide two numbers, as I did in this example
or
For this purpose you can use / sign.
Mow, in above example you see that if we divide 4 by 3 the answer will be in decimal, so the code should be used like this to also show the decimals.
You can see that we have set answer decimal points to 2, you can set 3 or more as your likeness.
5. Brackets: You can also use brackets ( and ) in your equations. For example.
In above example we have used brackets, so first it will calculate 2+4 and then will divide it with the 2.. So What should be the answer??? Yes it should be in decimal points because we have set it to 2. So the answer will be 3.
All above are the functions of math that can be used inside the :math: and :/math: tags. You can write anything inside both tags to calculate. You just need to revise the mathematical procedures for +, -, /, and *.
You can even do or in other words use all the operators in one go.. For example.
I hope that this tutorial will be helpful for you. Please comment below if you liked this tutorial and join us on facebook to be in touch and get updates whenever new tutorial is added to wapkatutor's awesome tutorials list.
0 replies:
Post a Comment