Series of Operations
Given an array
Sample Input
[ 12, 2, 2, 4, 1 ]
Sample Output
616 -14 -14 112 -77
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>SO</title>
<script language="javascript" type="text/javascript">
window.onload = function () {
var arrayValuesString = prompt("Enter the numbers using comma", "");
if (arrayValuesString != "") {
var values = arrayValuesString.split(",");
for (var i = 0; i < values.length; ++i) {
values[i] *= 9;
}
for (var i = 0; i < values.length; ++i) {
values[i] -= 20;
}
for (var i = 0; i < values.length; ++i) {
values[i] *= 7;
}
console.log("[" + values.join(",") + "]\n")
}
}
</script>
</head>
<body>
</body>
</html>
Comments
Leave a comment