Write a PowerShell script to get a Summary of 1 to 1000. i.e. Calculate the total of “1+2+3+4+5+6+7…+998+999+1000” You must use loop to do the calculation. Hint: The total is “500500” Manual summary of $Sum=1+2+3+4… is NOT acceptable. Using formula like $Sum= n(n+1)/2 is NOT acceptable.
$Sum = 0;
for($i=1;$i-le 1000;$i++){$Sum = $Sum + $i;};
$Sum
----------------------------------------------------------------------------------------------------
Your ThumbsUp on this answer matters to me a lot :)
----------------------------------------------------------------------------------------------------
For any further clarifications, Please do not hesitate to reach out
in the comments section
Get Answers For Free
Most questions answered within 1 hours.