Main.cc: In function ‘int main()’: Main.cc:10:9: error: ‘k’ was not declared in this scope while(k<=d*2-a*2+1){ ^ Main.cc:4:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&d); ~~~~~^~~~~~~~~