Total money to be paid after traveling the given number of hours | CPP implementation of the above approach ; calculating hours travelled
#include <bits/stdc++.h> NEW_LINE using namespace std ; int main ( ) { float m = 50 , n = 5 , x = 67 , h = 2927 ; int z = ( ceil ( h / 60 * 1.0 ) ) ; if ( z <= n ) cout << z * m ; else cout << n * m + ( z - n ) * x ; return 0 ; }