The flowchart to read 10 positive integers K>10 Start A N K=1 Sum = 0 Sum = Sum + K2 B Is Y Print K > 100? sum K=k+1 End B A
1 =1
algorithim and flow chart of odd number 1 and 50
The sum of the composite numbers between 1 and 50 is 936.
51
step 1 : n = 11, sum = 0 step 2 : then sum = sum + n2 step 3 : n = n + 2 step 4 : if n > 50, go to step 6 step 5 : loop to step 2 step 6 : print sum step 7 : end
you can use the condition statement like for(i=0:i<=10;i++)
sum of n natural number is n(n+1)/2 first 50 number sum is 50(50+1)/2 = 1275
51
A Sample java method that can do this sum of all numbers between 1 to 50 public int sumNumbers(){ int retVal = 0; for(int i = 0; i <=50; i++){ retVal = retVal + i; } return retVal; }
The general equation to find the sum of the numbers 1 to n is: (n*(n+1))/2So, for n=10, you have:(10*(10+1))/2(10*11)/2110/255
Why, that's just 6 times the sum of the numbers from 1 to 50 !The sum of the numbers from 1 to 50 is:1 + 50 = 512 + 49 = 513 + 48 = 514 + 47 = 515 + 46 = 51...etc. There are 25 pairs, and each pair sums to 51. So the sum of 1 ... 50 is (25 x 51) = 1,275.The sum of the first 50 multiples of 6 is (1,275 x 6) = 7,650.