fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int main() {
  7. double v, theta;
  8. cin >> v >> theta; // input kecepatan dan sudut
  9. double g = 9.8;
  10.  
  11. double rad = theta * M_PI / 180.0; // konversi ke radian
  12. double R = (v * v * sin(2 * rad)) / g;
  13.  
  14. cout << fixed << setprecision(1) << R << endl;
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0.01s 5284KB
stdin
37
10
stdout
47.8