140 likes | 338 Views
03/01/10. Math Library Functions. Programs 1 and 2 Grades. Use mutt to read email on onyx to find out your program grade. .forward could also be used for future assignments.Use functions from the math.h library to do special calculations. Objective.
E N D
03/01/10 Math Library Functions
Programs 1 and 2 Grades Use mutt to read email on onyx to find out your program grade. .forward could also be used for future assignments.Use functions from the math.h library to do special calculations.
Objective Use functions from the math.h library to do special calculations.
Side of Bandana Problem I am manufacturing bandanas. Given the amount of cloth I can afford for each bandana, I want to know the measure of the side of that square. Write a program to find out the measure of the side of the square bandana.
Algorithm 1. Input area 2. 3. Output side
Program bandana.c
Built-in Functions Call Syntax: fname(arg1, arg2,… argn) Example: s = sqrt(area); Include #include <math.h> Must use -lm option when compiling gcc -lm prog.c
More Functions in cmath • Examples log(88.5) --> 4.483 exp(4.483) --> 88.5
Example Write a program to find the 4th root of a number input by the user. fourthRoot.c
Find Age Difference Write a program to find the difference in age between two quarterbacks on a team.
Algorithm Input qb1 and qb2 difference = |qb1 – qb2| Output difference Write the program today in lab. Started in qb.c