Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do not understand how to write this code. It is being used in C programming. Please help! ) The L2 Norm (or Euclidean Norm) is

Do not understand how to write this code. It is being used in C programming. Please help! image text in transcribed
) The L2 Norm (or Euclidean Norm) is often used to calculate the magnitude of a vector or determine a best fit. Write a program that takes the L2 norm of 3 numbers, using the math.h library. This library grants access to pow(x,y), and sqrt(x). pow(x, y) raises x to the y-th power. To use these functions in your code, simply put #include . You may now use the functions mentioned previously (and so many more) without further reference. The L2 norm of three numbers is shown below: Prompt the user to enter 3 numbers the string "Enter 3 numbers (in the format: a b c): and print the L2 norm of the 3 numbers. Print the answer with 2 decimal place precision as seen in the example below. Enter 3 numbers (in the format: a bc): 1 2 3 3.74 Because we used an external library, we need to tell the compiler to link that library, or else it won't know where the math functions are coming from. -l is a compiler flag to link a library, followed by something that represents that library (for math.h the linker flag is -1m). To get your program to compile, you will need to add -1m to the gec command, i.e. run gcc 12 norm.c -1m -o 12 norm Notes: A, B, and C will all be integers, but the output X will be a float. There are NO double spaces. Name your file 12. norm.c Side-note: If your ever confused about a function like sqrt O, keep in mind you can almost always use the man command to get more information about C and C++ functions (e-g. man sqrt), it will even give you the linker flags! Submission Guidelines: Before submitting your work to the automatic grading system, you must compress all of your files into a tar file. To do this, use the following command in the Linux terminal: tar -cvf hu2.tar surf sphere.c speed.c combinations.c 12 norm.c This command will create the file hu2. tar containing your five source files. Submit hu2.tar in the HW2 assignment area at https://autograder.cse.buffalo.edu/ WARNING: If the tar file does not exactly match the format described above, then the autograder system will not be able to grade your work and will assign you a 0. If this happens then you will have to correct the file names and/or tar structure, create another tar file, and upload

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions

Question

1. Signs and symbols of the map Briefly by box ?

Answered: 1 week ago

Question

Types of physical Maps?

Answered: 1 week ago

Question

Explain Intermediate term financing in detail.

Answered: 1 week ago