I am not getting where exactly you are stucked? I mean does the program gives you a wrong output or it does not excepts the 2 characters or 2 numbers or something else is the case.
And as far as your next statement
What is the difference between scanf("%c", &v); and scanf("%c\n", &v);
I would say that the above two are altogether different.
"scanf("%c", &v);" this will accept the character including spaces as the input and stores it in "v" and the cursor will remain at the end of character while in latter the cursor will be at the next line.
Also, I want to bring to your notice that you have written a code which runs the for loop twice causing the value of "v" to be overwritten and same is applicable to the value of "w".
So, just check the code.