Hi. This is my first post, sorry if i seem a bit n00b.

I just started learning C and I met a problem.

Code:
#include <stdio.h>

double oper;
double a, b;
double add, minus, divide, times;

main()
{
 printf("Please choose an operator. 1 for addition, 2 for subtraction, 3 

for division and 4 for multiplication: \n");
 scanf("%d", &oper);
 printf("Enter the first number: \n");
 scanf("%
d", &a);
 printf("Enter the second number: \n");
 scanf("%d", &b);
 add = b + a;
 minus = a - b;
 times = a * b;
 divide = a / b;
 if (oper == 1) {
  printf("%d + %d = %d", a, b, add);
 }
 if (oper == 2) {
  printf("%d - %d = %d", a, b, minus);
 }
 if (oper == 3) {
  printf("%d / %d = %d", a, b, divide);
 }
 if (oper == 4) {
  printf("%d * %d = %d", a, b, times);
 }
 getchar();
 return 0;
}
Yeah. When i run this, none of the operators work. For example, while adding stuff and i type 1, 2 and then 3 i get 2 + 0 = 3.

But when I change the variables to int it all works again, just that it rounds off.

How can I solve this problem?