Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
138662 鄢晨曦 13求1+2-3+4-5+……n的值 C++ Compile Error 0 MS 0 KB 199 2025-11-29 13:37:21

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n,sum1; cin>>n; for(int i;i<=2;i++){ if(i%2==1){ sum-=i; } else{ sum+=i; } } cout<<sumj; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:4: error: 'sum' was not declared in this scope
    sum-=i;
    ^
Main.cc:11:4: error: 'sum' was not declared in this scope
    sum+=i;
    ^
Main.cc:14:8: error: 'sumj' was not declared in this scope
  cout<