Homework 2.1

mail@pastecode.io avatar
unknown
html
4 years ago
770 B
21
Indexable
Never
<!DOCTYPE html>
<head>
    <title>Homework 2.1</title>
</head>
<body>
<h2 id = "equation1"></h2>
<h2 id = "equation2"></h2>
<h2 id = "equation3"></h2>
<script>
function equation1(x){
    return x * x + 1;
}
function equation2(x, y){
    return 3*x*x + 2*y - 7;
}
function equation3(x, y, z){
    return (x+y+z)/3;
}
var x = 5;
document.getElementById("equation1").innerHTML = "Y = X^2 +1, x =" + x + ", ---> y = " + equation1(x);
var y = 10;
document.getElementById("equation2").innerHTML = "Z = 3*x*x + 2*y - 7, x =" + x + ", y = " + y + " ---> Z = " + equation2(x,y);
var a = 5;
var b = 7;
var c = 8;
document.getElementById("equation3").innerHTML = "Avg(" + a + ", " + b + ", " + c + ") ---> " + equation3(a,b,c);
</script>
</body>
</html>