Count the number of currency notes needed | Function to return the amount of notes with value A required ; If possible ; Driver code
< ? php function bankNotes ( $ A , $ B , $ S , $ N ) { $ numerator = $ S - ( $ B * $ N ) ; $ denominator = $ A - $ B ; if ( $ numerator % $ denominator == 0 ) return ( $ numerator / $ denominator ) ; return -1 ; } $ A = 1 ; $ B = 2 ; $ S = 7 ; $ N = 5 ; echo ( bankNotes ( $ A , $ B , $ S , $ N ) ) ; ? >