変数を使った計算式|JS課題01
解答
HTML
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>変数を使った計算式</title> </head> <body> <script type="text/javascript" src="index.js"></script> </body> </html>
JavaScript
var a = 10; var b = 8; var c = 12; var d = 4; var sum = a * (b + c) / d; document.write( a + "×(" + b + "+" + c + ")÷" + d + "=" + sum);