Matematicki operatori:
- + sabira dva broja
- - oduzima dva broja
- * mnozi dva broja
- / deli dva broja
- % vraca ostatak deljenja dva broja (deljenje po modulu)
Ovaj kod sacuvajte kao mat-operatori.php.
<?php
echo "5 + 2 = " , 5 + 2, "<br>"; // rezultat: 5 + 2 = 7
echo "5 - 2 = " , 5 - 2, "<br>"; // rezultat: 5 - 2 = 3
echo "5 * 2 = " , 5 * 2, "<br>"; // rezultat: 5 * 2 = 10
echo "5 / 2 = " , 5 / 2, "<br>"; // rezultat: 5 / 2 = 2.5
echo "5 % 2 = " , 5 % 2, "<br>"; // rezultat: 5 % 2 = 1
?>
Ovde mozete pogledati ugradjene matematicke funkcije.
Mathematical operators:
+ Adding two numbers
- Subtracting two numbers
* Multiplies two numbers
/ Divides two numbers
% Returns the remainder of dividing two numbers (modulo division)
This code save as math-operators.php.
Mathematical operators:
+ Adding two numbers
- Subtracting two numbers
* Multiplies two numbers
/ Divides two numbers
% Returns the remainder of dividing two numbers (modulo division)
This code save as math-operators.php.
<?php
echo "5 + 2 = " , 5 + 2, "<br>"; // R: 5 + 2 = 7
echo "5 - 2 = " , 5 - 2, "<br>"; // R: 5 - 2 = 3
echo "5 * 2 = " , 5 * 2, "<br>"; // R: 5 * 2 = 10
echo "5 / 2 = " , 5 / 2, "<br>"; // R: 5 / 2 = 2.5
echo "5 % 2 = " , 5 % 2, "<br>"; // R: 5 % 2 = 1
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.