Main.cc: In function 'int main()': Main.cc:6:9: error: conflicting declaration 'double c' double c=(a+b+c)/3; ^ Main.cc:4:10: note: previous declaration as 'int c' int a,b,c; ^ Main.cc:7:17: warning: format '%f' expects argument of type 'double', but argument 2 has type 'int' [-Wformat=] printf("%.2f",c); ^