An astrologer standing in a position at 0 0, then he made a route map for his journey. It looks like as given below strategy. With the help of your coding skills can you share the exact position where he is now?
At first he moved towards his east for 10meters at first turn, later he moved towards north 20m at second turn, next he went to his west for 30m at 3rd turn, then he moves towards south for 40m at 4th turn, then again east with 50m at 5th turn. It continues again but every time when he changed his direction additionally 10m will be added to previous value.
C program
Input Format:
Let user share the turning number
OUTPUT:
Display to the user, exact Astrologer position.
INPUT1:
3
OUTPUT1:
-20 20
INPUT2:
4
OUTPUT2:
-20 -20
INPUT3:
6
OUTPUT:
30 40
Answers
Answer:
Explanation:
An astrologer standing in a position at 0 0, then he made a route map for his journey. It looks like as given below strategy. With the help of your coding skills can you share the exact position where he is now?
At first he moved towards his east for 10meters at first turn, later he moved towards north 20m at second turn, next he went to his west for 30m at 3rd turn, then he moves towards south for 40m at 4th turn, then again east with 50m at 5th turn. It continues again but every time when he changed his direction additionally 10m will be added to previous value.
C program
Input Format:
Let user share the turning number
OUTPUT:
Display to the user, exact Astrologer position.
INPUT1:
3
OUTPUT1:
-20 20
INPUT2:
4
OUTPUT2:
-20 -20
INPUT3:
6
OUTPUT:
30 40