Main.cc: In function ‘int main()’: Main.cc:10:6: error: redeclaration of ‘int num’ int num=0; ^~~ Main.cc:4:13: note: ‘int num’ previously declared here int a,n,num=0; ^~~