Coding AddMul Series in JavaScript

This program takes 2 pair of numbers and we first add them and then multiply them. For example 11 and 11 = 4 because (1 + 1) * (1 + 1) = 4.


Code (Run Code) :

// This program takes 2 pair of numbers and we first add them and then multiply them. For example 11 and 11 = 4 because (1 + 1) * (1 + 1) = 4

function addMulSeries() {
var arr = [];
var num = [];
for (var i = 1; i < 11; i++) {
arr.push(i);
}

for (i of arr) {
num.push((i + i) * (i + i));
}

document.write(num);
}

addMulSeries();

No comments:

Post a Comment

Coding for Kids

What is coding? In coding we build a program to do a specific task for us. Code: A code is a set of computer instructions and when you will ...