PROBLEM 1: Create a function that will accept a distance in miles and will conve
ID: 3529396 • Letter: P
Question
PROBLEM 1: Create a function that will accept a distance in miles and will convert it kilometers, furlongs, and fathoms. Your function should accept one value as function input and will return (send back to the function call) 3 function outputs, one for each of the conversions. Your script file should ask the user to input an array for the distances in miles, then call the function. Create a table in the script file with the distance in miles in the first column, the distance in kilometers in the second column, the distance in furlongs in the third column, and the distance in fathoms in the fourth column. Use the disp function to create column headings for the units. Then use the fprintf function and the table to output the values. The distance in miles should be output with 2 decimal places, the distance in kilometers should be output to 4 decimal places, the distance in furlongs should be output to 3 decimal places and the distance for fathoms should be output to 1 decimal place. The width of each column should be 15. PROBLEM 2: Create a function that accept a whole number scalar value, then plot a polygon with that number of sides using a polar graph. Use the appropriate number of function inputs and function outputs. In your script file ask the user to enter the number of sides for the polygon, then call the function with this value.Explanation / Answer
problem 1 #include float conversion( ) { float dismile ,diskm; scanf(" input %f mile"; &dismile;); diskm=dismile/1.609 ret(diskm); }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.