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
Select the correct statement(s) regarding Frame Relay (FR). a. FR is a connection-oriented standard that operates at the OSI lay
DedPeter [7]

Answer:

d. all of the statements are correct

Explanation:

Frame Relay is a high-performance WAN protocol that operates at the physical and data link layers of the OSI reference model. i.e Layers 1 and 2 They are designed to cope with bursty traffic. Frame relay is also a form of data networking based on packet switching in which the packets are variable in length and experience packet delays.

Based on the above definition the correct statement is option d as all of the statements define in the other option correctly defines the function of frame relay.

7 0
3 years ago
. ------------- means only one company became historywhich is the acquired
Otrada [13]

Answer:

The correct answer is C. Acquisition means only one company became history which is the acquired company, while the acquiring company remains.

Explanation:

An acquisition occurs when one company or corporation takes control of another (the name itself indicates that the company that acquires the other is the dominant one). Generally, larger companies acquire smaller ones. In such cases, the company acquires a smaller one and establishes itself as the owner.

7 0
4 years ago
If you could build your own personal computer, what components would you purchase? Put
lesya [120]

Always start with the choice of a CPU first because that would determine other components. For example, let's say I want want to use AMD Ryzen Threadripper 3990X as the CPU, all I need to do is to refer to its specification to know what other componets will be compatible.

With the specification, we can tell that this CPU is only compatible with DDR4 RAM (up to 4 slots) and PCIe 4.0 Graphic Card. So, I'd probably get 8 DDR4 RAM (any brand should be fine) and a RTX3080Ti GPU if there is no budget limit.

Next, since we have chosen the CPU, RAM and GPU, we can now choose a motherboard based on these choices. In other words, all we need to do is look for a motherboard that is compatible with our choice of CPU, GPU and RAM.

Then, I'll look for a cooler for the CPU because the stock cooler usually isn't good enough if I want to overclock the CPU.

Next, I would choose a power supply unit (PSU) that can provide enough power for the GPU that I have selected and compatible with the motherboard.

Next, I'd decide what data storage to use for this custom built pc. I highly recommend at least one PCIe 4. 0 SSD as a boot drive and one standard SATA Hard Disk to store all data. I'll also add in a SATA DVD drive. SATA connectivity is pretty standard for storage drives, so they should all be compatible.

Okay, let's breakdown the cost (without any peripherals such as keyboard, monitor, mouse, etc):

  • CPU AMD Ryzen™ Threadripper 3990X ($5546.20)
  • GPU Gigabyte AORUS MASTER GeForce RTX 3080 Ti ($3049.03)
  • Motherboard MSI Creator TRX40 ($1359.99)
  • Memory Corsair Dominator Platinum 128 GB (8 x 16 GB) DDR4-3200 CL16 Memory ($3998)
  • Storage Samsung 960 Pro 2TB ($1999.99)
  • Cooler NZXT Kraken X72 Liquid CPU Cooler ($479.90)
  • Case Phanteks Enthoo Elite ATX Full Tower ($915.98)
  • Power Supply Corsair AXi ($787.99)
  • Operating System Windows 10 Pro ($199.99)

The total cost would be around $18,283.50

How does it compare to a similar computer purchased? With these choices, there isn't any similar pre-built computer by other brands such as Dell or HP because this pc is VERY powerful and highly customizable. The key difference is probably the lack of after-sales customer service if you buy components separately from different stores.

3 0
3 years ago
The sun can be an excellent source of natural light.<br> True.<br> False.
Blababa [14]

Answer:

The answer is TRUE

7 0
3 years ago
Read 2 more answers
The only item on the desktop of a new Mac is the hard-drive icon. <br><br> True or false?
Andre45 [30]

Answer:

False

There are many more items on the desktop of a new Mac than the hard-drive icon.

3 0
4 years ago
Other questions:
  • A document that promises to pay specified sums of money on specified dates and is a debt to the issuer is called
    14·1 answer
  • Secure Hashing Algorithm (SHA) is an algorithm for generating cryptographically secure one-way hash, published by the National I
    6·1 answer
  • To display rows from one table that do not have a corresponding row in the other table, you must create a(n) ___________________
    10·1 answer
  • The picture that graphically represents the items you use in windows is called a/an
    15·2 answers
  • a mobile base in an urban environment has the power of 15 microW at 175 m. If the propagation follows an inverse cube power law,
    11·1 answer
  • What tag pair is used to create the largest heading?
    10·1 answer
  • A(n) ____________________ is the collection of individuals responsible for the overall planning and development of the contingen
    10·1 answer
  • Give three reasons why Black hats hack?
    8·2 answers
  • What is a software? 2 sentences please, I'll mark u as brailiest
    12·1 answer
  • An anagram of a string is another string with the same characters in the same frequency, in any order. For example 'ab', 'bca, a
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!