X xy71420 普通会员 2006-03-06 72 0 0 2006-04-05 #5,042 #include <stdio.h> int main() { int i = 0; int nResult = 0; for(i = 0; i < 100; i++) { if ((i+1) % 2 == 0) nResult -= (i+1) esle nResult += (i+1); } printf("1-2+3....-100 = %d", nResult); return 0; }
#include <stdio.h> int main() { int i = 0; int nResult = 0; for(i = 0; i < 100; i++) { if ((i+1) % 2 == 0) nResult -= (i+1) esle nResult += (i+1); } printf("1-2+3....-100 = %d", nResult); return 0; }