This is not what you want:


scanf("%d%d%d", S, R, P );


1st: you are asking for three entries, instead of just ONE of those three choices.

2nd: you need the ADDRESS OF the variable, so...