(upbeat music)
- [Instructor] I hope you enjoyed this exercise
as it require you to write quite a few lines of code
as shown here in my solution.
Your solution need not look exactly like this.
Lines Eight through 11 are prompting for input.
First value a and then value b,
and the two floating point variables are defined here.
Floating points are necessary because of the division
that's required as part of the solution.
Lines 13 through 16, display the mathematical calculations,
addition, subtraction, multiplication, and division.
The power function is used at line 17 to obtain the power
of base a raise to exponent b.
Then two square root functions are required,
one to obtain the square root of a,
the second to obtain these square root of b.
Let me run my solution.
And I'm going to type in some low values to make sure
that things don't get too crazy.
Three and four and three plus four is seven,
three minus four is negative one, three times four,
you see that it all looks like, well, the square roots,
I know that the one for four is correct.
I'll assume that the one for three is also correct.
Potential warnings or errors you may have encountered during
this challenge include; missing semi-colons.
all see language statements in with a semi-colon.
You might've forgotten the weird ampersand
that appears in the scan F function.
You might have missed some parenthesis here or there.
Emitting an argument in the print F function,
one that doesn't match up exactly with the variable argument
specified is another common error.
You might've forgotten to include the math.h header file,
which is required for the power and square root functions.
You could also have forgotten the return at the end
of the main function.
Take such errors in stride.
We all make them and it's just part of the learning process.
The compiler alerts you with warnings and errors
showing you which line they've occurred in.
The messages may be crypticted now, but as you learn C,
you'll understand them, fix your code and eventually become
a great C language programmer.