answersLogoWhite

0

int sum = 0;

int i;

for(i = 0; i < n; ++i) {

sum += i;

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

The variance of first n natural numbers is?

1 Sum of first n natural numbers = n(n+1)2[Formula.]2 Arthmetic mean of first n natural numbers = Sum of the numbers n[Formula.]3 = n(n+1)2n = n+124 So, the Arthmetic mean of first n natural numbers = n+12


How do you find the mean of first n natural numbers?

The sum of the first n natural numbers is n*(n+1)/2 There are n numbers so their mean = (n+1)/2


What is the sum of the first 225 natural numbers?

Formula for sum of first natural number = n(n+1)/2 , here n=225 so, answer is 225(225+1)/2 = 25425


What is the sum of the squares of the first 20 natural numbers 1 to 20?

The sum of the first N square numbers is: N*(N+1)*(2N+1)/6 So putting N = 20 gives 2870.


What is the sum of the numbers from 1 to 100?

Sum of first n natural numbers is (n) x (n + 1)/2 Here we have the sum = 100 x (101)/2 = 50 x 101 = 5050


What is the c plus plus program for printing sum to n natural numbers?

main() { int i, n, sum=0; cout&lt;&lt;"Enter the limit"; cin&gt;&gt;n; for(i=0;i&lt;=n;i++) sum=sum+i; cout&lt;&lt;"sum of "&lt;&lt;n&lt;&lt;" natural numbers ="&lt;&lt;sum; getch(); }


Find the mean of n natural numbers?

Mean = (sum of the n numbers)/n


How do you get the sum of consecutive cubed numbers?

The sum of the first n cubed numbers is: [n*(n+1)/2]2 which is the same as the square of the sum of the first n numbers.


What is the sum of the first 50 natural numbers?

sum of n natural number is n(n+1)/2 first 50 number sum is 50(50+1)/2 = 1275


Program to calculate the sum of first ten natural numbers?

Algorithm to find the sum of first n natural numbers:1. Read n.2. Initialize N=1.3. Initialize sum S=0.4. Calculate S=S+N.5. Calculate N=N+1.6. If N>n, then goto step 7 else goto step 4.7. Write the sum S.8. Stop.


How do you calculate the sum of all numbers from 1 through 61?

The sum of the first "n" numbers is equal to n(n+1)/2.


What is the minimum unique array sum that can be achieved?

The minimum unique array sum that can be achieved is when all elements in the array are different, resulting in the sum of the array being equal to the sum of the first n natural numbers, which is n(n1)/2.