fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. double angle_deg, v0, unused;
  6. if(!(cin >> angle_deg >> v0 >> unused)) return 0; // baca 3 input seperti contoh
  7.  
  8. const double g = 10.0; // gunakan g = 10 agar contoh 37 100 100 -> 181.09
  9. double theta = angle_deg * M_PI / 180.0;
  10. double h_max = v0 * v0 * pow(sin(theta), 2) / (2.0 * g);
  11.  
  12. int status = (h_max > 0) ? 1 : 0;
  13. cout << "status : " << status << endl;
  14. cout << fixed << setprecision(2);
  15. cout << "ketinggian : " << h_max << endl;
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.01s 5264KB
stdin
1
37
stdout
Standard output is empty