Question: Write a program segment that computes 1 + 2 + 3 + ... + ( n - 1) + n , where n is a
Write a program segment that computes 1 + 2 + 3 + ... + ( n - 1) + n , where n is a data value. Follow the loop body with an if statement that compares this value to (n * (n + 1)) / 2 and displays a message that indicates whether the values are the same or different
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
