your code has error while taking input from user.
The proper way of getting input from user is :
printf("Enter value of a : ");
scanf("%d", &a);
printf("Enter value of b : ");
scanf("%d", &b);
Note: You have used \n in scanf which is wrong or the error of this code. \n is used for new line .so while storing the value in a and b we don't need new line so it is getting error there.
Hope This is helpful !
Happy Coding