Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
83879 石晋骁 阶乘的和 C++ Compile Error 0 MS 0 KB 259 2024-07-15 09:48:48

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int sum(int m){ int a = 1,b = 0; for(int i = 0;i < n;i++){ for(int j = 0;j < i;j++){ a = a*i; } b = b+a; } cout << b; } int main(){ int n; cin >> n; sum (n); return 0; }


Run Info:

Main.cc: In function 'int sum(int)':
Main.cc:5:20: error: 'n' was not declared in this scope
  for(int i = 0;i < n;i++){
                    ^
Main.cc:12:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^