fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. double v, g = 9.8;
  7.  
  8. cout << "Masukkan kecepatan awal (m/s): ";
  9. cin >> v;
  10.  
  11. // Sudut optimal 45 derajat -> sin(90) = 1
  12. double Rmax = (v * v) / g;
  13.  
  14. cout << "Jarak horizontal terjauh = " << Rmax << " meter" << endl;
  15.  
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.01s 5324KB
stdin
12
5
stdout
Masukkan kecepatan awal (m/s): Jarak horizontal terjauh = 14.6939 meter