Skip to main navigationSkip to main contentSkip to footer
Wiki Cram
  • Home
  • Blog
Wiki Cram

Suggested Time < 1 hr. UPLOAD C Script! Objective: To check...

Suggested Time < 1 hr. UPLOAD C Script! Objective: To check students knowledge on ARRAYs and LOOPs. We have a shape with “n” sides. You would like to know the distance between adjacent vertices. Also, you want to know the average distance, median distance, the shortest distance, and the longest distance.  The whole thing has to be done by using LOOP and ARRAY. You do not have to use User Defined function (UDF) for this question (But I would not mind if you decided to use UDFs.) Create a C script that 1. will prompt the user for the value of "n". The "n" is the number of the sides in a shape. 2. Then, the script should prompt the user prompt the user “n” times or “n x 2” times for (x, y) value of each vertex of the shape. 3. Then, compute the distance between adjacent vertices, then show!.4. Also, compute the average distance.5. Also, compute the median distance.6. Also, show the shortest distance and the longest distance.      Output Sample 1 (For this, distances are between (vertex 1 and vertex 2), between (vertex 2 and vertex 3 ), and between (vertex 3 and vertex 1)   Output Sample 2 (For this, distances are between (vertex 1 and vertex 2), between (vertex 2 and vertex 3 ), between (vertex 3 and vertex 4 ), and between (vertex 4 and vertex 1)     *Hint:  Say, we have a Hexagon (a shape with 6 sides, so n = 6). Distances between vertex 1 and vertex 2 between vertex 2 and vertex 3 between vertex 3 and vertex 4 between vertex 4 and vertex 5 between vertex 5 and vertex 6  can be computed by using a loop (by running the loop 5 times). Then, the distance between vertex 6 and vertex 1 can be placed in the array after the completion of the loop.    your_array = distance between vertex 6 and vertex 1     Distance formula between two points (X1, Y1) and (X2, Y2) :       

Suggested Time < 1 hr. UPLOAD C Script! Objective: To check...

Posted on: June 8, 2025 Last updated on: June 8, 2025 Written by: Anonymous Categorized in: Uncategorized
Skip back to main navigation
Powered by Studyeffect

Post navigation

Previous Post Suggested Time < 1 hr. UPLOAD C Script! Objective: To check...
Next Post Which statement correctly describes the behavior of IFNULL(p…
  • Privacy Policy
  • Terms of Service
Copyright © 2026 WIKI CRAM — Powered by NanoSpace