#include <iostream> using namespace std; int func(int n){ for(int i=1;i<=n;i++) if(i%2==0) cout<<i<<endl;} int main(){ n=8; cout<<func(n); return 0;}
Standard input is empty
prog.cpp: In function ‘int func(int)’: prog.cpp:7:17: warning: no return statement in function returning non-void [-Wreturn-type] cout<<i<<endl;} ^ prog.cpp: In function ‘int main()’: prog.cpp:9:4: error: ‘n’ was not declared in this scope n=8; ^
Standard output is empty