【C】#牛牛学数列#
牛牛学数列
https://www.nowcoder.com/practice/0b97367cd2184c12a0e02f7c223aee11
#include <stdio.h> int main() { int n, sum = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) { if (i % 2 == 0) sum += -i; else sum += i; } printf("%d", sum); return 0; }