int sum = 0; for (int i = 51; i < 200; i = i + 2){ sum += i; } return sum;
I can't imagine a useful reason to have a recursive function to find this, but here you go: int sumEvens(int start, int end) { // end condition if (start > end) { return 0; } // correction if we start on an odd number if (start % 2 == 1) { return sumEvens(start + 1, end); } // actual work return start + sumEvens(start + 2, end); } Invoke with sumEvens(2, 50) to get the sum of all even numbers in the range [2,50]
Sum = Sum + first number Sum = Sum + second number Sum = Sum + third number Average = 1/3 x Sum
to print the sum of first ten numbers:- void main() {int i,sum; sum=0; while(i<=10) sum=sum+i; i=i+1; } printf("The sum is : %d",sum); }
The following will sum all integers from 1-100. Adjust according to your needs.int sum = 0;for (int i = 1; i
The sum of the four given numbers is -13.
I would use 40 for the 38 and 50 for the 51. 90 would be my estimate.
51 divided 38 = 1.3421052631578947
Sum = 38 + M
Factors of 38 are 1, 2, 19, and 38.Factors of 51 are 1, 3, 17, and 51.
The sum is 28+38 = 66
the sum of 5 and 38 is 43
51
n + 51
(51 / 38) - (29 / 38) = (51 - 29) / 28 = 22 / 38 = 11/ 19 = 0.578947368421052631... (repeating)
25+51=76 76/2 = 38 The average of the two numbers is 38.
6 with 38 remaining 344 - 38 = 306 = 51 x 6