5. Using Python. Input an integer n. Write a program to calculate Sn = Sn=1- 2+3-4+5-6...+x*n, here the coefficient of n
Posted: Fri Apr 29, 2022 6:38 am
5. Using Python. Input an integer n. Write a program to calculate Sn = Sn=1- 2+3-4+5-6...+x*n, here the coefficient of n is x. x=1or-1, which depending on the parity of n. If n is odd, then x=1, else x=-1.