Pass the address of n
in scanf
scanf("%d", &n);
Just as a side note, you don't need to start your loop from 0
to calculate the sum
for(a=1; a <= n; ++a) //start from 1
Doesn't do much but saves one iteration.
Also, use preincrement when you do not intend to use the result of the expression as it has a slightly lesser overhead than postincrement.