Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// recursive function to find sum from 1 to n
int recur_Sum(int n)
{ // base condition
if (n <= 1)
return n;
// recursive call
return n + recur_Sum(n - 1);
}
// main function
int main()
{
// variables
int n;
cout<<"Enter a number:";
// read the number
cin>>n;
// print the sum
cout<<"Sum of first "<<n<<" integer from 1 to "<<n<<" is:"<<recur_Sum(n);
return 0;
}
Explanation:
Read a number from user and assign it to variable "n".Call function recur_Sum() with parameter "n".This function will recursively call itself and find the Sum of first n numbers from 1 to n.Then function will return the sum.
Output:
Enter a number:10
Sum of first 10 integer from 1 to 10 is:55
Answer:
HTML is a significant tool for building up a site. It is a programming language used to describe the structure of information on a web page.
Explanation:
Answer:
One of the most important skills you need to build as a Python developer is to be able to run Python scripts and code. This is going to be the only way for you to know if your code works as you planned. It’s even the only way of knowing if your code works at all!
This step-by-step tutorial will guide you through a series of ways to run Python scripts, depending on your environment, platform, needs, and skills as a programmer.
Explanation: