Program to find the percentage of difference between two numbers | Function to calculate the percentage ; Driver Code . ; Function calling
function percent ( a , b ) { var result = 0 ; result = ( ( b - a ) * 100 ) / a ; return result ; } var a = 20 , b = 25 ; document . write ( percent ( a , b ) + " " ) ;