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 is the syntax of an of if statement
Usimov [2.4K]
The syntax for a if statement is; The condition evaluates for either true or false. True is always a non-zero value, false is a value that contains zero
6 0
3 years ago
What is a reason for zipping a file?A. to encrypt themB. to return them to their original sizeC. so they display properly on a W
Morgarella [4.7K]

A reason for zipping a file is:

  • D. to combine multiple files into one.

<h3>What is Zipping a File for?</h3>

When a person converts any file to a Zip, it may have one of the following reasons:

  • Reduce the size of the files.
  • Merge files into one.
  • Facilitate the sending of files by mail or others.

Therefore, among the given options, it is possible that a person has as objective to combine multiple files into one, in this way you will be able to find in a single file the information concerning a specific topic and send or transport it more easily.

If you want to learn more about Files, you can visit the following link: brainly.com/question/4461652

5 0
3 years ago
A soft news story and a feature story are the same thing.<br> O True<br> O False<br> HELLPP ASSAAAP
bogdanovich [222]
The answer would be False!
5 0
3 years ago
Read 2 more answers
A multi-national retail company has multiple business divisions with each division having its own AWS account. The engineering t
velikii [3]

Answer:

C. X-ray

Explanation:

AWS X-ray is a form of service that assists developers in carrying out analysis and debugging functions, and at the same time helps in the allotted applications, including those built using a microservices architecture.

In other words, an X-ray, in this case, will assist the developers in carrying out the following:

1. Establish a service map

2. Single out errors and bugs

3. Construct analysis and visualization apps

4. Enhancing the experience for end-users of the application under x-ray.

4 0
3 years ago
Which account type is require to join the computer to the domain?
yulyashka [42]

Answer:

the computer must have an account in the domain which, like a user account, includes a logon name (sAMAccountName), a password, and a security identifier (SID) that uniquely represent the computer as a security principal in the domain.

Explanation:

-Hailey:

4 0
3 years ago
Other questions:
  • Most panoramic photography focuses on what subject?
    9·2 answers
  • (04.01 MC)
    11·1 answer
  • Elaine had a problem with the computer printer she purchased. When she called the toll-free service number, she was told that sh
    7·1 answer
  • The Cisco IOS automatically modifies the dead interval when the _____ interval is changed. (Points : 2) hello
    13·1 answer
  • Explain the four basic operation performed by every computer​
    11·2 answers
  • By observing human behavior,_______are able to understand the cause and effect relationship between the supply of things we want
    13·2 answers
  • Is an architecture where a client runs an applications provided by a server on a network
    7·1 answer
  • Which are three possible text formatting actions in wordpad?
    6·1 answer
  • HELP ME ON THIS PLEASE ILL GIVE BRAINLY!!!! If U GET IT RIGHT !!!
    10·1 answer
  • How could this code be simplified?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!