Question: Rules: You can use all course material and man pages, but you should be able to solve the problems below without web searches or communicating

 Rules: You can use all course material and man pages, but

Rules: You can use all course material and man pages, but you should be able to solve the problems below without web searches or communicating with other students. In the final exam you will be asked to solve similar problems ... Your programs must compile without warning or errors using g++ -g -Wall -Wextra -Wconversion -Wsign-conversion -0 ... on our lab machines. If there are compiler warnings or errors, there will be considerable mark deductions Test your programs with different values. For now, the speed of your programs is irrelevant. So don't spend time on optimization Your programs must be well structured. Use ctrl-x t in Emacs or a similar command in your editor of choice to pretty-print it Marks are assigned to functionality and program appearance In case your program hangs, use ctrl-c to terminate it Submit p1.c p2.c on eClass by the end of the lab You can submit as often as you want. We will only consider the last submission for marking Problem 1 (5 marks): Iterated Digit Sum In file p1.c write a function called iterated_digit_sum that computes the sum of base-10 digits of a given unsigned int x and repeats that computation for the result until the value doesn't change anymore Examples: iterated_digit_sum (0) = 0 iterated_digit_sum (26) = 8 iterated_digit_sum (11111) = 5 iterated_digit_sum (22222) = 1 In function maino provide code to test your function You can't use functions from math.h Problem 2 [*] (5 marks): log(x) In file p2.c write a function double mylog(double x) that approximates the natural logarithm of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!