Structures and Pointers – Geometry – Problem #4

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

Difficulty: medium

Problem Statement

Define a structure to represent a circle in terms of coordinates of its centre (a, b) and its radius r. Assume these values to be float. Write a function which takes as input two such structure variables and returns 1 if the circles intersect or if they touch at a point, and 0 if they do not. (Think a bit on how you can handle the case of touching at a point using float variables.) In the main program input six numbers in a1, b1, r1, a2, b2, r2, order and store them in two such structure variables. Next, call this function and print if the input circles, intersect or touch at a point, or do not.

Back to Lab Problems
Structures and Pointers/Geometry/Problem #4

Lab Problem Statement

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

Interactive C Compiler · Problem #4

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.