Join Dan Gookin for an in-depth discussion in this video Making more calculations, part of Learning C.
- When you can't find an operator to do your math…you need to turn to the C library.…There you'll find fund and friendly functions…to sate your mathematical whims.…In this movie I cover two of the typical…C language math library functions,…the square root function and the power function.…I'll also introduce the random number generating…function, which isn't really a math function,…but it's something you may find quite handy.…To generate the square root of a value…you use the sqrt function.…It reads like squirt, but it's really square root.…
The square root function is shown at line eight.…It requires the math.h header file…which is included on line two.…The function swallows a floating point value…specified as 2.0.…It returns the square root as a floating point value…which is saved in the float variable r.…The print f function on line 10 displays the results.…Build and run the code.…And now you know the square root of two…or any other value you specify in the code.…
Another math function worthy of note…is the pow function which is short for power.…
- Understanding a C program
- Adding comments
- Using escape characters
- Working with values and placeholders
- Introducing variables
- Making a decision with if
- Adding functions
- Manipulating strings
- Building arrays
- Nesting structures
Skill Level Beginner
1. Getting Started
2. Programming Basics
3. Program Flow Control
4. Intermediate C Language Concepts
5. Advanced C Language Concepts
Next steps2m 11s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.