Main.cc: In function 'int main()': Main.cc:9:23: error: 'sum' was not declared in this scope printf("sum=%d\n",sum); ^ Main.cc:7:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d",&a,&b); ^