sum of natural number using javascript
<script>
var number = parseInt(prompt("Please Enter the number."));
var sum = 0;
for(var i=1;i<=number;i++){
sum += i;
}
alert(sum);
</script>
sum of natural number using javascript
<script>
var number = parseInt(prompt("Please Enter the number."));
var sum = 0;
for(var i=1;i<=number;i++){
sum += i;
}
alert(sum);
</script>
0Comments
Thanks you for commenting your questions. I will see question and respond you.