Program to find the count of coins of each type from the given ratio | function to calculate coin . ; Converting each of them in rupees . As we are given totalRupees = 1800 ; Driver code
function coin ( totalRupees , X , Y , Z ) { var one = 0 , fifty = 0 , twentyfive = 0 , result = 0 , total = 0 ; one = X * 1 ; fifty = ( ( Y * 1 ) / 2.0 ) ; twentyfive = ( ( Z * 1 ) / 4.0 ) ; total = one + fifty + twentyfive ; result = ( ( totalRupees ) / total ) ; return result ; } var totalRupees = 1800 ; var X = 1 , Y = 2 , Z = 4 ; var Rupees = coin ( totalRupees , X , Y , Z ) ; document . write ( " " + Rupees * 1 + " " ) ; document . write ( " " + Rupees * 2 + " " ) ; document . write ( " " + Rupees * 4 + " " ) ;