answersLogoWhite

0


Best Answer

sum = 0

for(n = 0; n <= 10; n += 2) sum += n;

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Algorithm to find the sum of even numbers between 1 to 10?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write algorithm and draw flowchart to find the sum of even numbers?

jgfujtf


Can you write an algorithm to find the beast numbers?

maybe


How many even numbers can you find between 20 and 40?

Show a modified algorithm flowchart to list even numbers between 20 and 40, 22, 24, 26, 28, 30, 32, 34, 36, 38 and that is 9 numbers


How can you use the Euclidean Algorithm to find the GCF of three numbers?

By dividing


What are the examples of algorithm in the flow chart?

TO find the sum of n numbers?


What do you notice when you find the difference between an odd and even numbers?

The answer is an odd number.


What is the algorithm of LCM of more than 3 numbers?

If you use methods based on prime factors, it is the same whether you have 2, 3, or more numbers: find all the factors that occur in any of your numbers. If you use a method based on Euclid's Algorithm (that is, lcm(a, b) = a x b / gcf(a, b), where you find the gcf with Euclid's Algorithm), then you can find the lcm for two numbers at a time. For example, to get the lcm of four numbers, find the lcm of the first two, then the lcm of the result and the third number, than the lcm of the result and the fourth number.


What do you notice when you find the difference between two odd numbers?

The difference is an even number.


What happens to the median when you come up with two answer?

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.


Is there an algorithm that will automatically solve a Rubik's cube?

Such an algorithm is called a 'God algorithm', from the fact that it would only be known by god/the gods. Although many have tried to find it, none have so far discovered it (assuming it exists). To solve a cube by algorithm, you need to know the appropriate algorithm to apply and when in the stages of solving; different sets can use large numbers of algorithm.


Examples of Euclid's algorithm for finding GCD of large numbers?

Euclid's algorithm is a time-tested method for finding the greatest common divisor (GCD) of two numbers. It's based on the principle that the greatest common divisor of two numbers also divides their difference. This algorithm is efficient and works well for large numbers, making it a practical choice in numerous applications. The algorithm operates in a recursive or iterative manner, continually reducing the problem size until it reaches a base case. Here’s how Euclid's algorithm works: print (gcd (a, b) ) # Output: 3ere &gt;a&gt;b , subtract b from a. Replace a with (a−b). Repeat this process until a and b become equal, at which point, a (or b) is the GCD of the original numbers. A more efficient version of Euclid’s algorithm, known as the Division-based Euclidean Algorithm, operates as follows: Given two numbers a and b, where &gt;a&gt; b, find the remainder of a divided by b, denoted as r. Replace a with b and b with r. Repeat this process until b becomes zero. The non-zero remainder, a, is the GCD of the original numbers. In this example, even though a and b are large numbers, the algorithm quickly computes the GCD. The division-based version of Euclid’s algorithm is more efficient than the subtraction-based version, especially for large numbers, as it reduces the problem size more rapidly. Euclid's algorithm is a fundamental algorithm in number theory, with applications in various fields including cryptography, computer science, and engineering. Its efficiency and simplicity make it a powerful tool for computing the GCD, even for large numbers.


Algorithm to find the sum of even numbers between 1and 10?

1.start 2.n=1,s=0 3 compute s=s+n 4 compute n=n+1 5 check n&lt;=10 go to step3 else go to step 7 6 display s 7 stop