Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C program: Thanks for helping! Write a program that will read up to 100

ID: 3677041 • Letter: W

Question

Write a C program:

Thanks for helping!

Write a program that will read up to 100 circles. It is to compute the area of each circle and is to sort the circles by increasing areas. If two circles have the same area, the one whose centre is closest to the origin should come first in the sorted list. If two circles have the same area and their centres are at the same distance to the origin, they should appear in the sorted list in the order they were input. Your program is to use the point and circle typedefs from Problem 2. For circle, you should add an extra variable for the area. The circles are input as specified in Problems 2 so you should reuse the readCircle function (you can modify it if you find that convenient). Input: The circles will be entered one per line as three doubles. For example 2.3 4.5 6.2 is a circle centred at x=2.3 and y=4.5 with radius 6.2. The end of input is indicated by a line with a nonnumeric e.g. stop or end. There will be no more than 100 circles input and you can assume there are no errors in the inputOutput: The sorted list of circles is to be displayed with one circle per line. Each circle is to be displayed in the following format illustrated for the example circle above: c= (2.3000,4.5000) r = 6.2000 a = 120.7628 You are responsible for making up your own test data to verify your program works correctly for all cases.

Explanation / Answer

C-Program to find the area of a circle:-

printf("Enter the number of circles:");

scanf("%d",&n);

{

printf("Enter the radius of a circle : ");
scanf ("%f", &radius);

printf("Enter the co-ordinates of the circle:");

sacnf("%f%f",&x,&y);

area = PI * pow (radius,2);

printf ("Area of a circle = %5.2f ", area);

printf("press any key to exit");

printf("centre,radius,area",(x,y),radius,area);

}

To sort the circles use bubble sort;-

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote