How to print id of user whose profile I visit rather than id of  logged in user?
If you add this to the user-profile.tpl.php template, it will show the UID of user account being viewed. 

&lt;?php echo $account-&gt;uid;?&gt;