Write a function in C to find the difference between the sum of the squares of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function in C to find the difference between the sum of the squares of the first n (you should taken with the user input) natural numbers and the square of the sum. The sum of the squares of the first ten natural numbers is, 12+22+ +10²=385 The square of the sum of the first ten natural numbers is, (1+2+...+10)² =55²=3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025-385-2640 You should have two functions: one of them should calculate sum of squares of first n natural number and the other should calculate squares of sum for first n natural number. Your functions should take one integer parameter for the user input and return results. Then you should calculate the difference between obtained sums. Sample: DACENG111ab9sumsquare.exe enter a number: 3 square of sum: 36 sum of square: 14 result= 22 Write a function in C to find the difference between the sum of the squares of the first n (you should taken with the user input) natural numbers and the square of the sum. The sum of the squares of the first ten natural numbers is, 12+22+ +10²=385 The square of the sum of the first ten natural numbers is, (1+2+...+10)² =55²=3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025-385-2640 You should have two functions: one of them should calculate sum of squares of first n natural number and the other should calculate squares of sum for first n natural number. Your functions should take one integer parameter for the user input and return results. Then you should calculate the difference between obtained sums. Sample: DACENG111ab9sumsquare.exe enter a number: 3 square of sum: 36 sum of square: 14 result= 22
Expert Answer:
Related Book For
Managing Business Ethics Making Ethical Decisions
ISBN: 9781506388595
1st Edition
Authors: Alfred A. Marcus, Timothy J. Hargrave
Posted Date:
Students also viewed these programming questions
-
For each of the following transactions or adjustments, indicate the effect of the transaction or adjustment on the appropriate balance sheet category and on net income by entering for each account...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Use Eq. (13) to show that (x, y) = ln r is harmonic. 1 Af = frr + fee + = fr 1 2
-
In the publication "What Makes a High School Great?" (Newsweek, May 8, 2006, pp. 50-60), B. Kantrowitz and P.Wingert looked for America's best high schools. One relevant variable is the percentage of...
-
1. No life decisions are happenings based solely on logic. 2. All electric motors are machines that depend on magnetism. 3. Some political campaigns are mere attempts to discredit opponents. 4. Some...
-
Adapt the Kremser equation to leaching with constant flow rates.
-
Sanders Co. is planning to finance an expansion of its operations by borrowing $150,000. City Bank has agreed to loan Sanders the funds. Sanders have two repayment options: (1) To issue a note with...
-
The NOI for a small Income property is expected to be $150,600 for the first year. Financing will be based on a 1.2 DCR applied to the first year NOI, will have a 10 percent Interest rate, and will...
-
1. Consider the problem of returning change to a customer requiring the smallest number of coins. a. Show that the greedy algorithm given below returns the smallest number of coins for the coin set...
-
Implement the three public functions: a 1 - argument constructor that creates an empty HashTable, given a capacity. All values in the table should be set to - 1 to indicate that they are empty....
-
On 17 June you can buy a CD maturing on 10 December with a face value of 6,000,000 with a yield to maturity of 2.68 per cent. You can also purchase for 5,950,000 an identically risky CD with the same...
-
Briefly explain the nature of public-key cryptography.
-
Wombat Ltd. is a Sydney-based company that specializes in gathering and processing seismic data. It is employed by oil companies all over the world to undertake work in support of their exploration...
-
Give five items that might be captured on the accounting audit trail in relation to data input in the input subsystem.
-
Define and distinguish among the following three terms: population mean, mode, and median. Calculate or determine the value of each term for the following population: 26, 71,56, 3, 47, 865, 14, 3,...
-
How do phylogenetic methods, such as maximum likelihood, Bayesian inference, and coalescent-based approaches, reconcile the complexities of evolutionary processes, including incomplete lineage...
-
Digital Fruit is financed solely by common stock and has outstanding 25 million shares with a market price of $10 a share. It now announces that it intends to issue $160 million of debt and to use...
-
You have worked together with three other stock brokers in the same company for the past 12 years. The four of you are the best of friends, with strong personal ties going back 30 years; you grew up...
-
You are a plant manager at a manufacturing company. Relationship between your management team and factory workers is generally harmonious. You and the other managers have worked your way up through...
-
1. What are the benefits and costs of using a common currency for Greece, Germany, and the EU? 2. How do the austerity programs imposed by the bailouts help a Greek firm that exports olive oil? 3....
-
The greater the rate of economic growth, the _________ rapidly poverty will be eradicated.
-
Using a relative definition of poverty, poverty cannot be eradicated by economic growth but only by _________.
-
Because the federal income tax is _________, it tends to redistribute income in a way that reduces income disparities.
Study smarter with the SolutionInn App