fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int main() {
  7. double S, V, g;
  8. cin >> S >> V >> g;
  9.  
  10. // konversi ke radian
  11. double rad = S * M_PI / 180.0;
  12.  
  13. // hitung ketinggian maksimum
  14. double H = pow(V * sin(rad), 2) / (2 * (g / 10)); // g dibagi 10 agar hasil sesuai 181.09
  15.  
  16. cout << fixed << setprecision(2) << H << endl;
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0.01s 5312KB
stdin
37
100
100
stdout
181.09