The best answer is to forget using scanf, and do this
This does two things
fgets( buff, sizeof(buff), stdin );
1) it removes the need for any fflush(stdin), which doesn't work anyway (despite local appearances that it might)
2) you now have the whole line in memory
The problem with scanf, is that it is a one-way trip - if you get stuck, there's no going back except to ask the user to retype it all.
Now if you want to, you could do this
sscanf is like scanf, except it works on in-memory strings - the advantage being, you can have several goes at decoding it, and you need not even use sscanf to decode it (you could do your own thing)
x = sscanf( buff, "%d/%d%n", &num1, &denom1,&last);
A note about %n - this tells you where in the string you got to
buff[last] is the index of the first unscanned character in buff. Also note, that x would be still 2 (not 3 as you might expect)
> BTW all the books I have seem to make no distinction between %d and %i
They're wrong then
If you have %d, then you must type 10, to read in decimal 10
If you have %i, you can type 10, 0xa or 012, as the decimal, hexadecimal or octal versions of decimal 10.