Implement the recursive algorithms factorial sum Fibonacci p
Implement the recursive algorithms: factorial, sum, Fibonacci, print, & palindrome.
Implement a recursive algorithm to sum the first N integers and compare the run times with the iterative algorithm that you (may have) implemented in Problem 1.
Problem 1: Write a C++ program to accept a positive integer, N, as an input and display the sum of the first N integers as output.
i.e. 1 + 2 + 3 + . . . + N
Be sure to document your code with preconditions and post condition statements.
Solution
Providing solution to Problem 1)
#include<iostream.h>
#include<stdio.h>
void main()
{int sum =0,n;
cout<<\"Enter an integer value\";
cin>>n;
for(int i =1;i<=n;i++)
{
sum = sum+i;
}
cout<<\"Sum is\"<<sum<<endl;
}
The above solution could be
