Alpha Geek

(8)

$10/per page/Negotiable

About Alpha Geek

Levels Tought:
University

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Environmental science,Essay writing,Programming,Social Science,Statistics Hide all
Teaching Since: Apr 2017
Last Sign in: 345 Weeks Ago, 3 Days Ago
Questions Answered: 9562
Tutorials Posted: 9559

Education

  • bachelor in business administration
    Polytechnic State University Sanluis
    Jan-2006 - Nov-2010

  • CPA
    Polytechnic State University
    Jan-2012 - Nov-2016

Experience

  • Professor
    Harvard Square Academy (HS2)
    Mar-2012 - Present

Category > Programming Posted 20 Jun 2017 My Price 3.00

Write definitions for the following two functions

Write definitions for the following two functions:

sumN(n) returns the sum of the first n natural numbers.

sumNCubes(n) returns the sum of the cubes of the first n natural numbers.

Then use these functions in a program that prompts a user for n and prints out the sum of the first n natural numbers and the sum of the cubes of the first n natural numbers.

 

Answers

(8)
Status NEW Posted 20 Jun 2017 09:06 AM My Price 3.00

-----------

Attachments

file 1497955174-Answer.docx preview (73 words )
A-----------nsw-----------er ----------- Th-----------e f-----------irs-----------t f-----------unc-----------tio-----------n i-----------s a-----------s g-----------ive-----------n b-----------elo-----------w. -----------int----------- su-----------mN(-----------int----------- n)----------- { -----------int----------- su-----------m=0-----------; f-----------or(-----------int----------- i=-----------1;i----------- { -----------sum-----------=su-----------m+i-----------; }----------- co-----------ut -----------} T-----------he -----------sec-----------ond----------- fu-----------nct-----------ion----------- is----------- as----------- gi-----------ven----------- be-----------low-----------. i-----------nt -----------sum-----------Ncu-----------bes-----------(in-----------t n-----------) {----------- in-----------t s-----------um=-----------0; -----------for-----------(in-----------t i-----------=1;-----------i {----------- su-----------m=s-----------um+-----------(i*-----------i*i-----------); -----------} c-----------out----------- } -----------The----------- C+-----------+ p-----------rog-----------ram----------- fo-----------r t-----------his----------- pr-----------obl-----------em -----------con-----------tai-----------nin-----------g t-----------he -----------two----------- fu-----------nct-----------ion-----------s i-----------s a-----------s g-----------ive-----------n b-----------elo-----------w.I----------- ha-----------ve -----------com-----------pil-----------ed -----------and----------- ex-----------ecu-----------ted----------- th-----------e p-----------rog-----------ram----------- in----------- De-----------v C-----------++ -----------com-----------pil-----------er -----------env-----------iro-----------nme-----------nt.-----------I h-----------ave----------- at-----------tac-----------hed----------- th-----------e s-----------amp-----------le -----------out-----------put----------- al-----------so -----------for----------- n=-----------10 -----------
1497955184-2027592_1_636334854129909431_Sum-and-cubes.jpg
Not Rated(0)