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
Documental acerca de los principales materiales que se emplean en la fabricación de medios técnicos utilizados en una oficina.
Diano4ka-milaya [45]

Answer:

Los equipos técnicos utilizados en una oficina y los principales materiales utilizados en su fabricación son;

Equipo de oficina {}    Material utilizado en la fabricación

1) Impresoras;           {}    Acero, aluminio, alambres de cobre, plástico, rodillos

2) Monitor de computadora; {}   Pantalla de vidrio, plástico, cables, placas de circuito, resortes

3) Escáneres;     {}  Alfombra compuesta, mesa de vidrio, carcasa de plástico, cables

4) Copiador;   {}       Carcasa de plástico, contenedor de tóner, placa de vidrio, cables de alimentación

5) Proyector;    {}    Lente de vidrio y carcasa de metal para lámpara, cables de alimentación

6) Desfibradora; {}    Engranajes de plástico, correa de cadena de metal, rodamientos

Explanation:

4 0
2 years ago
Select the most likely outcome of making only on-time minimum payments to a credit
Serjik [45]
The answer is B. Your will have gone mostly towards paying interest and you will still owe the majority of the balance that you had from ago
4 0
3 years ago
The rock cycle _____.
creativ13 [48]
The best and most correct answer among the choices provided by the question is the second choice. The rock cycle <span>changes and recycles Earth's rocks. </span>I hope my answer has come to your help. God bless and have a nice day ahead!
8 0
3 years ago
write a program to update the rate by increasing 20% from sequential data file "items.dat" that store item name.rate and quantit
sveticcg [70]

Answer:

your answer is in the pic

(◔‿◔)

。◕‿◕。

6 0
2 years ago
Select the correct answer.
Crank

Answer:

Sensing elements.

Explanation:

Sensing elements are the device which connect channels feedback and return it to the control system input. There are many sensors used for feedback control such as Tachometer, Encoders, Accelerometers and rate gyroscopes.

3 0
3 years ago
Other questions:
  • What daily life problems does the algorithm quicksort solve?
    14·1 answer
  • . A register in a computer has a of bits. How many unique combinations can be stored in the register?
    5·1 answer
  • Why you should care about copyright
    13·1 answer
  • Callie Crystal owns and operates one of the most successful local coffee shops in Denver, called The Edgewater Café. Each time a
    5·2 answers
  • Select the correct answer.
    10·1 answer
  • What is the BCC feature used for?
    12·2 answers
  • In order to personalize your desktop, you may click on: Start&gt;settings&gt;Personalization . . .
    9·1 answer
  • 8.5 Edhesive Code Practice
    14·1 answer
  • What would give Lucy, an entry-level candidate, an edge over others while she seeks a programmer’s position? Lucy, an entry-leve
    11·1 answer
  • The memory used by the CPU to temporarily hold data while processing is called _______. random access memory central processing
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!