I'm trying to create a simple calculator in C.

So far this is what I've got.

#include<stdio.h> #include<stdlib.h> int main(void) { char ch; int a,b; printf ("Would you like to add,multiply, subtract or divide? Press,a,m,s or d for your choice"); ch = getchar(); if ('%c'= a) { printf("enter two numbers to add"); scanf("%d%d",a,B)/>; add_total = a+b; printf("The answer is %d",add_total); } if('%c'= m) { printf("enter two numbers to multiply"); scanf("%d%d",a,B)/>; mult_total = a*b; printf("The answer is %d", mult_total;); } if ('%c'= s){ printf("enter two numbers to subtract"); scanf("%d%d",a,B)/>; sub_total = a-b; printf("The answer is %d",sub_total); } if ('%c'= d) { printf("enter two numbers to divide"); scanf("%d%d",a,B)/>; div_total = a/b; printf("The answer is %d",div_total); } else{ printf("Not a valid selection"); } return (0); }

I am fully aware that there is probably a much easier one line way of doing all this but i want to learn what is wrong with this code.( Of course this is not to say any alternative solutions are not welcomed!)

Any input appreciated.