Skip to content

Commit

Permalink
Create Assignment.js
Browse files Browse the repository at this point in the history
  • Loading branch information
shwetansh90 authored Dec 28, 2024
1 parent b4fc85f commit 95792d7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Assignment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
let n = 5;
let sum = 0;
let output = "";

for (let i = 1; i <= n; i++) {
sum += i;
output += i;
if (i < n) {
output += "+";
}
}

output += `=${sum}`;
console.log(output);

0 comments on commit 95792d7

Please sign in to comment.