sum = 0
for(n = 0; n <= 10; n += 2) sum += n;
Chat with our AI personalities
1.start 2.n=1,s=0 3 compute s=s+n 4 compute n=n+1 5 check n<=10 go to step3 else go to step 7 6 display s 7 stop
The difference is an even number.
when you have an even amount of numbers while trying to find the median, you first find the two numbers that are at the median and then take all the numbers between them and find the median of that. if that amount of digits is also even, then you must have a decimal median.
52+54+56 = 162
write an algo to find the sum of even number from 1to n