try:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
unsigned int num1, num2, num3;
char s[80];
int main (){
printf("type in an expression: ");
scanf(" %x %s %x", &num1, s, &num2);
if(strcmp ("add", s) == 0){
num3 = num1 + num2;
}
if(strcmp("subtract", s) == 0){
num3 = num2 - num1;
}
printf("the answer is: %x\n", num3);
system("pause");
}
note: notice that I remove \n
in the scanf
..