I have this C app I am trying to make, basically what it does is takes two numbers then adds, subtracts, divides or multiplies the number depending on what the user enters. However, it doesent work... For example it seems to think 1+1 is 1... What am I doing wrong?
Code:
#include <stdio.h>
main()
{
int a,b,c,d;
printf ("Command-line calculator tool by Josh. \n");
printf ("Enter the first number ");
scanf ("%d" ,&a);
printf ("Enter the second number ");
scanf ("%d" ,&b);
printf ("Do you want to +, -, * or /? ");
scanf ("%d",&c);
d=a,c,b;
printf ("The answer is %d \n" ,d);
}