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
< ? php function coin ( $ totalRupees , $ X , $ Y , $ Z ) { $ 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 ; } $ totalRupees = 1800 ; $ X = 1 ; $ Y = 2 ; $ Z = 4 ; $ Rupees = coin ( $ totalRupees , $ X , $ Y , $ Z ) ; echo "1 ▁ rupess ▁ coins ▁ = ▁ " , $ Rupees * 1 , " STRNEWLINE " ; echo "50 ▁ paisa ▁ coins ▁ = ▁ " , $ Rupees * 2 , " STRNEWLINE " ; echo "25 ▁ paisa ▁ coins ▁ = ▁ " , $ Rupees * 4 , " STRNEWLINE " ; ? >