Question: C++ CODE int str_length(char s[], int start); // Recursive version of strlen. // It returns the length of the substring from s[start] to // the
C++ CODE
int str_length(char s[], int start); // Recursive version of strlen. // It returns the length of the substring from s[start] to // the char before '\0', // inclusive. When str_length(s, 0) is called, the length // of s is returned.
int sum(int n); // Recursive version to calculate the sum of // 1 + 2 + .... + n
C++ Sample run should look like below
![C++ CODE int str_length(char s[], int start); // Recursive version of strlen.](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4e539cbfd0_49766f4e5395bf51.jpg)
The highlighted part is input. Enter a positive integer: 10 The sum of 1+2+.. .+10 is: 55 Enter a sentence: Hello World! It contains 12 chars, including white spaces Do you want to have another run? Y/N: y Enter a positive integer: 100 The sum of 1+2+. . .+100 is: 5050 Enter a sentence: I love programming! It contains 19 chars, including white spaces Do you want to have another run? Y/N:n Program ended with exit code: 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
