본문 바로가기

Javascript

산술 연산자 // Arithmetic Operators

아래에 코드 있어요!

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h3>산술연산</h3><hr>
    <script>
        var x = 32;
        var total = 100 + x * 2 / 4 - 3;
        var div = x / 10;
        var mod = x % 2;
        document.writeln(x+"<br>");
        document.writeln(total+"<br>");
        document.writeln(div+"<br>");
        document.writeln(mod+"<br>");
        document.writeln("==================<br>");
        ////////////////////////////////////////////////
        var a = 3, b = 3, c = 3;
        a+=3;//a=a+3
        b*=3//b=b*3
        c%=2//c=c%2
        document.writeln(a+"<br>");
        document.writeln(b+"<br>");
        document.writeln(c+"<br>");
 
    </script>
</body>
</html>
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs