Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我被要求为我的 C 编程课程创建这个 for 循环,但我不知道如何交替正负值。先感谢您!
sum2=1-x+x^2-x^3+⋯+/-x^n
提示:将表达式视为 (-1*x)^i 的总和,其中 i = 1, 2, 3, ..., n。如果 n 为偶数,则 (-1*x)^i 为正数,如果为奇数则为负数。