I don't know how to declare it as global variable but whats the matter with this case if p n r are declared globally
Code:
var p=Number(document.getElementById("pa").value);
var n=Number(document.getElementById("ny").value);
var r=Number(document.getElementById("ri").value);
function si()
{
var s=p*n*r/100;
alert("Total Interest Amount is "+s.toFixed(2));
}
function ta() {
var s=p*n*r/100;
var t = p+s;
alert("Total Amount Payable is "+t.toFixed(2));
}