When i assign int r, s, t, u, v; none of the if conditions are working.
When i assign int r=0, s=0, t=0, u=0, v=0; all the if conditions are working.
Well, yes, that is what I would expect.
In C, when you declare a variable:
int x;
you allocate space for it, but you do not assign a value, and the system will not create one for you: whatever is in that memory from the last time it was used - which could be anything from part of a string to a pointer depending on what your code did at run time up to that point - is left in the variable.
When you declare a variable
int x = 0;
You allocate space for it, and say "I want this to be zero" so the system obliges.
In your code, you declare the variables, but do not assign any value to them before you use them in the if conditions: so the values they contain and that you test against are random, and unlikely to be zero!