1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
OverLord2011 [107]
3 years ago
11

Write a recursive function to compute sum of first N integers starting with 1.

Computers and Technology
1 answer:
Citrus2011 [14]3 years ago
4 0

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

You might be interested in
What are the basic tasks performed by an operating system?​
Kruka [31]

Answer:

An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disk drives and printers.

Explanation:

i hope it helps:)

3 0
2 years ago
Where is the "delete account" button in my profile? And please give me a legit answer and not just a word.
N76 [4]

Answer:

in your profile for brainley ??

3 0
2 years ago
Read 2 more answers
Most networking media send data using _____ in which data is represented by only two discrete states: 0s and 1s.
dlinn [17]

Answer:

i think digital signals

Explanation:

A digital signal is a signal that is being used to represent data as a sequence of discrete values; at any given time it can only take on one of a finite number of values.[1][2][3] This contrasts with an analog signal, which represents continuous values; at any given time it represents a real number within a continuous range of values.

6 0
3 years ago
Read 2 more answers
FREE BRAINLIEST!!!
Nastasia [14]

Answer:

B

Explanation:

4 0
3 years ago
Read 2 more answers
In the SDLC's third phase, the way in which a proposed information system will deliver the general abilities described in the pr
kifflom [539]

Answer: Detailed

Explanation:

SDLC consist of 7 phases. They are:

1. Planning.

2. System analysis and requirement

3. Design:

4. Coding:

5. Testing:

6. Installation

7. Maintenance

Here we are talking of the third phase. In this phase it is the design phase which consist of high and low level design. Here the preliminary design is included in high level design where it describes the required hardware, software, network capabilities and the modelling of the interface. However the detailed design in low level design will implement the coding and will finding of any errors in the implemented design as described by the preliminary design.

3 0
3 years ago
Other questions:
  • Click to move a stacked object to the top of the stack?
    8·1 answer
  • What are the conditions for using still photos in a video program
    6·1 answer
  • 8) The higher the drag coefficient, the_____ the car will go<br> a)Siower<br> b)Faster
    9·2 answers
  • create a boolean variable called sucess that will be true if a number is between -10 and 10 inclusively python
    11·1 answer
  • Write a Java program that generates a new string by concatenating the reversed substrings of even indexes and odd indexes separa
    5·1 answer
  • If you want Nud3s add me on sc Kermit4lyfe1
    11·2 answers
  • When creating a shape in Word, what are some available options? Check all that apply. adding text to the shape changing the size
    6·1 answer
  • What are your undertale + au ships?
    15·1 answer
  • 19. List three things you can do to protect your online reputation:
    7·1 answer
  • C++
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!