tokio

05-08-2009, 09:17 PM

I want to find the summation of the integers from 1-100. So i want to find 1+2+3+4+5+...n. The first thing i thought about issuing a for loop to print the number of terms, and i was then thinking of a function to sum up all of the terms.

for ($i=1; $i<100;$i++) {

print $i; // prints terms 1-100

}

Any recommendations to find the summation of the terms? Thanks.

Tokio

for ($i=1; $i<100;$i++) {

print $i; // prints terms 1-100

}

Any recommendations to find the summation of the terms? Thanks.

Tokio