Skip to content

Commit

Permalink
[C++] Add solution for Jumbled Compass
Browse files Browse the repository at this point in the history
  • Loading branch information
ejrcarr committed Feb 3, 2024
1 parent 5457583 commit ff65594
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Solutions/Jumbled Compass/compass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <iostream>

using namespace std;

int main() {
int current, target;
cin >> current >> target;

if ((target - current) > 180) {
cout << (target - current - 360);
} else if ((target - current) > -180) {
cout << (target - current);
} else {
cout << (target - current + 360);
}
return 0;
}

0 comments on commit ff65594

Please sign in to comment.