Question

Write a PowerShell script to get a Summary of 1 to 1000. i.e. Calculate the total...

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.

Homework Answers

Answer #1

$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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
A = [-1000:1:1000] write a script file that gives the positive numbers greater than 480 and...
A = [-1000:1:1000] write a script file that gives the positive numbers greater than 480 and divisible by 3. Hint: Use this command if A(i)>480&&(rem(A(i),3)==0) and indeed, if is always accompanied by an end Note: Using Matlab
Instructions PowerShell Assignment #1 Objective: Learn basic Powershell scripting in Windows Setup: A Windows computer with...
Instructions PowerShell Assignment #1 Objective: Learn basic Powershell scripting in Windows Setup: A Windows computer with the latest Powershell environment installed Script #1 – Hello World! Description:  The classical introductory exercise: Just say "Hello, World!". Purpose: A "Hello, World!" program is traditionally used to introduce novice programmers to a programming language. It is also to make sure that the interpreter is installed correctly, and that the user understands how to use it. Instructions:  Complete this assignment to make sure that you know...
Write and upload a MATLAB script to do the following. Compute the sequence S(n+1) = (2...
Write and upload a MATLAB script to do the following. Compute the sequence S(n+1) = (2 – K) S(n) – S(n-1) ;   Assume S(1) = 0, S(2) = 1; (a)    Case 1, Assume K = 1 (b)    Case 2, Assume K = 2 (c)     Case 3, Assume K = 4 Plot all of these on the same plot, for N = 1 to 20
Written in MASM Assembly Problem Definition: Write a program to calculate Fibonacci numbers. • Display the...
Written in MASM Assembly Problem Definition: Write a program to calculate Fibonacci numbers. • Display the program title and programmer’s name. Then get the user’s name, and greet the user. • Prompt the user to enter the number of Fibonacci terms to be displayed. Advise the user to enter an integer in the range [1 .. 46]. • Get and validate the user input (n). • Calculate and display all of the Fibonacci numbers up to and including the nth...
1) Write an algorithm to calculate the sum of the following series:           Sum =x-x3/3! +...
1) Write an algorithm to calculate the sum of the following series:           Sum =x-x3/3! + x5/5! – x7/7! +…….     Stop when the                     term<0.0001.    2) An internet service provider charges its subscribers per month as follows:           Data usage (n), in gbs           charges (NIS)           0.0<n<=1.0                                250           1.0<n<=2.0                                500           2.0<n<=5.0                              1000           5.0<n<=10.0                            1500                   n>10                                 2000          Write a C program to read the usage(n) from a file and print the charges to be paid by...
Write a MASM program that computes the sum of the integers from 1 to N where...
Write a MASM program that computes the sum of the integers from 1 to N where N is a positive integer. Use the equal sign directive to define N. Save the sum in the EAX register. You must use loops. For example, 1 = 1 1 + 2 = 3 1 + 2 + 3 = 6 1 + 2 + 3 + 4 = 10 1 + 2 + 3 + 4 + 5 = 15 Language ( Assembly)...
Write a R script where you answer the following questions: 1. Consider Y ∼ Binom(n =...
Write a R script where you answer the following questions: 1. Consider Y ∼ Binom(n = 10, p = 0.05). Find the following probabilities: (a) P(2 < Y < 5) (b) P(2 ≤ Y ≤ 5) (c) P(Y < 9) 2. Consider Y ∼ P oisson(λ = 0.5). Find the following probabilities: (a) P(Y = 5) (b) P(2 ≤ Y ≤ 5) (c) P(Y < 9) 3. Consider Y ∼ N(µ = 3, σ2 = 1). Find the following probabilities:...
Please make sure you show what you input (i.e., PV=-1000, I/Y=10%, N=30 solved for FV=17449.40). Make...
Please make sure you show what you input (i.e., PV=-1000, I/Y=10%, N=30 solved for FV=17449.40). Make sure you round to 2 decimal points in your answers. 1. I want to be able to buy a car with cash in 4 years. I have $10,000 that I can invest today. I can get a bond earning 3%. How much will I have for the purchase?
1. Calculate the mean and standard deviation for the numbers 1 – 20. ​i.e.) 1, 2,...
1. Calculate the mean and standard deviation for the numbers 1 – 20. ​i.e.) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ​Note: The set of numbers will be considered the population. ​µ = _______​​​σ = ________ 2. With your calculator, randomly generate 5 numbers from the numbers 1 – 20, 30 times. ​Use:​[MATH]>>>PRB #5 ​​RandInt(1,20,5)​[ENTER]​​Note: You cannothave the same number repeated in the group of 5. ​​​​​​For...
One way in which computers can compute the values of functions like the sine, cosine, logarithm...
One way in which computers can compute the values of functions like the sine, cosine, logarithm and so on is to use a power series expansion. This is an infinite series from which the first few terms are calculated and used to find an approximate value for the function. The series expansion for the exponential function is : ex = exp(x) = 1 + x + x2 /2! + x3/3! + x4 /4/! + … + xn /n! + …...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT