Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write aCprogram that asks the user to Enter the coordinates (x1, y1) which is the center of a circle with radius 1. Enter the coordinates

image text in transcribed

Write aCprogram that asks the user to Enter the coordinates (x1, y1) which is the center of a circle with radius 1. Enter the coordinates (x2, y2) of a point in the Cartesian plane Prints whether point in (x2, y2) is inside, on the boundary, or outside the circle. Y our program should be interactive and ask the user if he/she wants to repeat another calculation by pressing any key, or enter q to quit. Test cases: (x1, y1) (x2, y2) (0, 0)(1, 0) (0, 0)(0.5, 0.5) (1, 1)(1, 0) (1, 2) (- 5, 5) Using, in between %f in scanf function above allows a user to type, between the two numbers when he/she enters the coordinate. Sample code execution: Red is entered by a user Enter coordinates (x1, y1): 0, 0 Enter coordinates (x2, y2): 1, 0 (1.0, 0.0) is on the boundary of a circle of radius 1 centered at (0.0, 0.0) Do you want to continue (q to quit)? y Enter coordinates (x1, y1): 0, 0 Enter coordinates (x2, y2): 0.5, 0.5 (0.5, 0.5) is inside a circle of radius 1 centered at (0.0, 0.0) Do you want to continue (q to quit)?y Enter coordinates (x1, y1): 1, 1 Enter coordinates (x2, y2): 1, 0 (1.0, 0.0) is on the boundary of a circle of radius 1 centered at (1.0, 1.0) Do you want to continue (q to quit)? Y Enter coordinates (x1, y1): 1, 2 Enter coordinates (x2, y2): -5, 5 (-5.0, 5.0) is outside a circle of radius 1 centered at(1 .0, 2.0) Do you want to continue (q to quit)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Explain the Neolithic age compared to the paleolithic age ?

Answered: 1 week ago

Question

What is loss of bone density and strength as ?

Answered: 1 week ago