Question: write C code for Both (A-B) In Question 2 Question 2 [7marks): A- Assume we have a lake that changes in volume according to the
Question 2 [7marks): A- Assume we have a lake that changes in volume according to the daily weather conditions. In a sunny day, it loses 2% of its volume. In a cloudy day, the volume stays the same, and for a rainy day, the volume increases by l%. To know today's weather assume that the rainy days have probability of 30% of the days, and sunny days have probability of 35% of the days, and the rest are cloud days. 2.5 Marks Write a recursive C function that takes the current lake volume V and the number of days N, and returns the resulting volume after N days. Your function prototype is: float computeVolume (float V, int N) 5/6 B- Develop a C method that, given a Strings, returns the reverse of s. Let c0c1c2...cn be a string, where each ci is a character. Then its reverse is cncn-1...c2c1c0 Notice that the first character of the reverse is the last character of the original and that what follows it is the reverse of the string obtained by chopping off the last character of the original string. Combining this with the observation that the reverse of the empty string is itself, we surmise that if s has length zero reverse(s) - a +reverse(s) otherwise where + denotes concatenation, s' denotes s with its last character chopped off, and a denotes the last character of s. 2.5 Marks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
