1+2+3+4.....+100 = 101*50= 5050
303
The sum of the numbers up to 100 is equal to (100 x 101)/2 = 5050
Sum of numbers from 1 to 100:(1+100) + (2+99) + (3+98) + (4+97) + ... + (49+52) + (50+51) =50 pairs, each pair adds up to 101= (50 x 101)= 5,050
2*100 = 200 12*10 = 120 14*1 = 14 Sum = 334
You add the numbers in a loop. Here is an example in Java:int sum = 0;for (int i = 1; i
2
2
if (n%2==0) sum=n/2*(n+1); else sum=(n+1)/2*n;
Sum = 79*(79+1)/2 = 79*80/2 = 3160
1+2+4 = 7
The sum of the numbers given is 31. 1 + 2 + 4 + 8 + ... + 2n = 2n+1 - 1