Day 26: Sum of N Numbers of 100DaysCodingChallenge
Hello all,
I have started the 100 days of coding challenge to improve my programming skills..
Today is the Day26 of 100DaysCodingChallenge for
Sum of N Numbers input Numbers taken by the user.
Code :
let n = prompt("Enter N : "); let sum = 0; // let sum; for (let i = 0; i <= n; i++) { sum = sum + i; // console.log(sum + i); // i++; } console.log("The Sum of first ", n, "numbers is ", sum);
Output :
Happy Coding:)
Comments
Post a Comment