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
Blizzard [7]
3 years ago
10

Write a recursive function sumAll that accepts an integer argument and returns the sum of all the integers from 1 up to the numb

er passed as an argument. For example, if 50 is passed as an argument, the function will turn the sum of 1, 2, 3, 4, ..50.
Computers and Technology
1 answer:
slavikrds [6]3 years ago
8 0

Answer:

int sumAll(int n)//function definition.

{

   if(n==1)//if condition.

   return 1;

   else//else condition.

   {

       return n+sumAll(n-1);//return the value and call the function in recursive manner.

   }

}

Explanation:

  • The above-defined function is a recursive type function that is written in the c language, which holds the if and else condition.
  • When the user passes the largest value from 1, then the else condition will be executed which adds the largest value and pass the value after the decrement of the value as an argument.
  • When the value will become 1, then the function if-block will be executed which returns the value and ends the calling function recursively.
You might be interested in
1. _____ are used to clarify code, but are not interpreted by the interpreter as commands. (1 point)
mariarad [96]

Answer:

1. D Comments

2. B False

3. C Logical Expression

8 0
4 years ago
Read 2 more answers
I need help with cisco please
Dmitry [639]

A cisco develops, manufactures and sells networking hardware, software, telecommunications equipment and other high-technology services and products. ... They pioneered the concept of a local area network (LAN) being used to connect geographically disparate computers over a multiprotocol router system.

Hope that helps.

4 0
3 years ago
Which of the following file formats allows you to share and save documents
mariarad [96]
OPTION A would be the answer
7 0
2 years ago
What function would you use to calculate the total interest paid for the first year of a mortgage?.
WITCHER [35]

Answer:

To calculate the total interest paid for the first year of a mortgage, the formula M = [P.r (1+r)n] / [(1+r)n-1] × 12 can be used.

Explanation:

3 0
2 years ago
Write a method rearrange that takes a queue of integers as a parameter and rearranges the order of the values so that all of the
Ksju [112]

Answer:

i got the answer

Explanation:

hope you can too

6 0
3 years ago
Other questions:
  • Who would be a member of the American Dental Association?
    10·1 answer
  • What is constructive criticism?
    9·1 answer
  • What is f(-3) for the function f(a)=-2a2-5a+4?​
    10·1 answer
  • Most sus color in Among Us? Red is safe I saw him scan. I'll give brainliest because why not. I'm bored.
    14·2 answers
  • What is a slide master ?
    8·2 answers
  • How do you know when a spreadsheet object is active in a Word document?      A. The Ribbon is minimized. B. The Excel Formula ba
    10·2 answers
  • Word processing software, spreadsheet software, database software, and presentation software are examples of what category of co
    13·1 answer
  • Write a program great_circle.python that takes four float arguments x1 y1 x2 y2
    15·1 answer
  • In a black box model are the customers told that they should be expecting to be haxked?
    13·1 answer
  • Anyone want to play mine mincraft w/ me?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!