WEBVTT 1 00:00:00.000 --> 00:00:06.000 (upbeat music) 2 00:00:06.000 --> 00:00:07.006 - [Instructor] I hope you enjoyed this exercise 3 00:00:07.006 --> 00:00:10.005 as it require you to write quite a few lines of code 4 00:00:10.005 --> 00:00:12.003 as shown here in my solution. 5 00:00:12.003 --> 00:00:16.001 Your solution need not look exactly like this. 6 00:00:16.001 --> 00:00:19.003 Lines Eight through 11 are prompting for input. 7 00:00:19.003 --> 00:00:21.008 First value a and then value b, 8 00:00:21.008 --> 00:00:24.008 and the two floating point variables are defined here. 9 00:00:24.008 --> 00:00:27.000 Floating points are necessary because of the division 10 00:00:27.000 --> 00:00:30.009 that's required as part of the solution. 11 00:00:30.009 --> 00:00:36.007 Lines 13 through 16, display the mathematical calculations, 12 00:00:36.007 --> 00:00:42.006 addition, subtraction, multiplication, and division. 13 00:00:42.006 --> 00:00:46.002 The power function is used at line 17 to obtain the power 14 00:00:46.002 --> 00:00:51.000 of base a raise to exponent b. 15 00:00:51.000 --> 00:00:53.001 Then two square root functions are required, 16 00:00:53.001 --> 00:00:56.001 one to obtain the square root of a, 17 00:00:56.001 --> 00:01:00.002 the second to obtain these square root of b. 18 00:01:00.002 --> 00:01:03.009 Let me run my solution. 19 00:01:03.009 --> 00:01:07.003 And I'm going to type in some low values to make sure 20 00:01:07.003 --> 00:01:09.000 that things don't get too crazy. 21 00:01:09.000 --> 00:01:12.002 Three and four and three plus four is seven, 22 00:01:12.002 --> 00:01:14.008 three minus four is negative one, three times four, 23 00:01:14.008 --> 00:01:18.007 you see that it all looks like, well, the square roots, 24 00:01:18.007 --> 00:01:20.004 I know that the one for four is correct. 25 00:01:20.004 --> 00:01:25.009 I'll assume that the one for three is also correct. 26 00:01:25.009 --> 00:01:28.004 Potential warnings or errors you may have encountered during 27 00:01:28.004 --> 00:01:31.004 this challenge include; missing semi-colons. 28 00:01:31.004 --> 00:01:35.006 all see language statements in with a semi-colon. 29 00:01:35.006 --> 00:01:37.007 You might've forgotten the weird ampersand 30 00:01:37.007 --> 00:01:40.008 that appears in the scan F function. 31 00:01:40.008 --> 00:01:44.007 You might have missed some parenthesis here or there. 32 00:01:44.007 --> 00:01:47.004 Emitting an argument in the print F function, 33 00:01:47.004 --> 00:01:50.003 one that doesn't match up exactly with the variable argument 34 00:01:50.003 --> 00:01:52.004 specified is another common error. 35 00:01:52.004 --> 00:01:55.005 You might've forgotten to include the math.h header file, 36 00:01:55.005 --> 00:02:00.002 which is required for the power and square root functions. 37 00:02:00.002 --> 00:02:02.007 You could also have forgotten the return at the end 38 00:02:02.007 --> 00:02:04.008 of the main function. 39 00:02:04.008 --> 00:02:07.001 Take such errors in stride. 40 00:02:07.001 --> 00:02:10.004 We all make them and it's just part of the learning process. 41 00:02:10.004 --> 00:02:13.003 The compiler alerts you with warnings and errors 42 00:02:13.003 --> 00:02:15.004 showing you which line they've occurred in. 43 00:02:15.004 --> 00:02:19.002 The messages may be crypticted now, but as you learn C, 44 00:02:19.002 --> 00:02:22.009 you'll understand them, fix your code and eventually become 45 00:02:22.009 --> 00:02:25.002 a great C language programmer.