변환 공식 -
1 km/hr = 5/18 m/sec or 0.277778 m/sec 1 m/sec = 18/5 km/hr or 3.6 km/hr
예
Input-: km = 60.00 mk = 70.00 Output-: speed in meter per second = 16.6667 speed in km per hour = 252
알고리즘
Start Step 1 -> Declare function to convert km/hr into m/sec float km_m(float km) return (0.277778 * km) Step 2 -> Declare function to convert m/sec into km/hr float m_km(float mk) return (3.6 * mk) step 3 -> In main() declare variable as float km = 60.0 and float mk = 70.0 Print km_m(km) Print m_km(mk); Stop
예시
#include <bits/stdc++.h> using namespace std; //function to convert km/hr into m/sec float km_m(float km){ return (0.277778 * km); } //function to convert m/sec into km/hr float m_km(float mk){ return (3.6 * mk); } int main(){ float km = 60.0; float mk = 70.0; cout << "speed in meter per second = " << km_m(km)<<endl<< " speed in km per hour = " << m_km(mk); return 0; }
출력
speed in meter per second = 16.6667 speed in km per hour = 252