473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

I would be thankful for any help!!

4
I need to write a program to find the sum, sum of squares, sum of the cubes, and sum of a certain series shown below for the first n integers, begining with 1 and ending with n = 100.

Summing the first 100 natural numbers:

n(n+1)
1 + 2 + 3 + ..... + n = ----------
2

Sum of squares of the first 100 natural numbers:

n(n+1)(2n+1)
1² + 2² + 3² + ……. n² = -------------------
6

Sum of cubes of the first 100 natural numbers:

n² (n + 1)²
1³ + 2³ + 3³ + ……. + n³ = --------------
4

Another series:

1 1 1 1 n
------- + ------- + ---------- + .......... ---------- = ------
(1 * 2) (2 * 3) (3 * 4) n*(n+1) n +1

Since all of these series involve summing the same number of terms, do all of the summing inside ONE(1) loop. Compute the formats outside the loop. Use n as a variable in the formulas; do not replace it with 100, because the formulas work for any n and the program should be flexible enough to easily change the number of terms.
Nov 14 '06 #1
2 1861
horace1
1,510 Expert 1GB
implement the program one section at a time, i.e. first Summing the first 100 natural numbers:

1 + 2 + 3 + ..... + n = n(n+1) / 2

an algorithm is
Expand|Select|Wrap|Line Numbers
  1. sum=0
  2. for i=1 to 100 
  3.     sum = sum + i
  4. print sum
  5.  
when that is working add the code for the next section, etc

do you also have to prove the sum = n(n+1) / 2
Nov 14 '06 #2
cNoob
4
implement the program one section at a time, i.e. first Summing the first 100 natural numbers:

1 + 2 + 3 + ..... + n = n(n+1) / 2

an algorithm is
Expand|Select|Wrap|Line Numbers
  1. sum=0
  2. for i=1 to 100 
  3.     sum = sum + i
  4. print sum
  5.  
when that is working add the code for the next section, etc

do you also have to prove the sum = n(n+1) / 2
No I dont hve to......... But im So lost please help :(
Nov 14 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: hallosenthil | last post by:
the relations are MEMBERSHIP(membership_number (pk), cover_type(pk), start_date(pk), end_date) PERSON(person_number(pk), surname, initials, street_address, suburb, , membership_number)
3
by: Tommy Lang | last post by:
I am working on this project and I need some help/pointers/comments to get me started, I am stuck. The program will be used to store information in an array while it is running. I need to store...
3
by: Martin | last post by:
Hi, this is probably a very basic question but I'm not a javascript expert! Sure you get this asked often! Did some research but can't get it working. I'm thankful for any help! Thanks! ...
1
by: Nick | last post by:
Deear All, I would be thankful if you could help me with the following query. I have two tables TableA and TableB TableA Name: David Address: 123 West Side City: New York
4
by: Bob Homes | last post by:
In VB6, I used a system, which I loved, whereby I assigned a "helpId" to each menu item; that way, you could rest the cursor on the item (without actually running it) and then press F1 to get...
5
by: bhatia | last post by:
Hello all, I am implementing JPEG-LS for my very specific use, but I am not being able to fine proper specifications for it's format. Can anybody please help me out and come forward with some...
1
by: vadarv | last post by:
Hia! I'm a total amateur to VBS but need help on a VBS script. This is used in a HMI system from Siemens called WinCC, used for process viewing and control. What I need to is to write to a table...
6
by: GeorgeRXZ | last post by:
Hi Friends Last week i posted following questions related to C Language in this group 1What is the difference between the standard C language and Non standard C language ? 2which is...
10
by: alhomam | last post by:
hi all, i found a program that provide a solution of how to create a timeline report similar to microsoft project i made my changes on the program some of the results is berfict and others...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.