Array and Strings – Geometry – Problem #2

IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive

Difficulty: hard

Problem Statement

Read N (to be read) 2-D coordinate points in two different arrays for X and Y coordinates, respectively. It then reads X and Y coordinates of a point p and compute its closest and furthest points in the list. Print those pairs and their distances from p. It also prints the average distance of N points from p. Provide output for the following input data set. (i) N=4 (1,1), (5.87,5), (1,10.45), (10,1) p=(2.4, 3.8) (ii) N=8 (-1,45.4), (5.8,5), (8,9.45), (-5.12,-67), (3,45.89), (-4,-4.6), (12,-50.12),(50,-50) p=(-5.0, 4.7)

Back to Lab Problems
Array and Strings/Geometry/Problem #2

Lab Problem Statement

Specifications & Problem DetailsIIT Kharagpur PDS Archive
Loading question...

Interactive C Compiler · Problem #2

WASM In-Browser

Runs directly on your machine · Zero remote server dependency

Compiler downloads on first Run (large, saved in your browser after that)
main.cCtrl + Enter to run
1
2
3
4
5
6
7
Input (stdin)given to scanf / cin
Output

Output appears here. Press Run to compile and execute.