Question
4 . Write a C program that reads the first letter of direction (North, South, East, West), current (x,y) coordinate, and advancement of a person
4. Write a C program that reads the first letter of direction (North, South, East, West), current (x,y) coordinate, and advancement of a person and prints the new coordinate. For e.g., if the current coordinate of a person in X- Y plane is (2,3) and s/he advances 6 units towards North, then his/her new coordinate is (2,3+6)=(2,9). Sample input/output (bold ones are user inputs):
Enter current coordinate (x and y positions): 2 3
Enter No. units towards direction: 6
Enter Direction: N
New coordinate: (2,9)
5. Solve question#4 using switch-case.
please write the c programs for this questions
4. Write a C program that reads the first letter of direction (North, South, East, West), current (x,y) coordinate, and advancement of a person and prints the new coordinate. For e.g., if the current coordinate of a person in X- Y plane is (2,3) and s/ he advances 6 units towards North, then his/her new coordinate is (2,3+6)=(2,9). Sample input/output (bold ones are user inputs): Enter current coordinate (x and y positions): 23 Enter No. units towards direction: 6 Enter Direction: N New coordinate: (2,9) 5. Solve question\#4 using switch-caseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started