Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(While loops)MATLAB problem Write a program that uses a while loop to calculate

ID: 669744 • Letter: #

Question

(While loops)MATLAB problem

Write a program that uses a while loop to calculate the sum of the first n positive integers. The value for n is provided by the user. sum_n = l+2+3+...+n Note: although there is a built-in function called sum () that can easily achieve the goal you are not allowed to use it for this assignment. You may try it in your free time. Write a script that will prompt the user to enter an 'x'. If the user enters an 'X' within three trials, it will print "Thank you!", otherwise it will print a warning.

Explanation / Answer

4)

Output-------------------------------------------

Enter an integer: 100

Sum = 5050