Advertisement
DarthLucius

Polar Angle-2129

Mar 5th, 2020
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. using namespace std;
  5. int main() {
  6.     const float pi=4*atan(1);
  7.     float y,x,pa;
  8.     cin>>x>>y;
  9.     pa=atan2(y,x);
  10.     if(pa<0){
  11.     cout<<fixed<<setprecision(6)<<pa+2*pi;
  12.     }
  13.     else {
  14.         cout<<fixed<<setprecision(6)<<pa;
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement