Study guides

☆☆

Q: Write an algorithm to print sum of all even numbers?

Write your answer...

Submit

Still have questions?

Related questions

write an algorithm to print first N even numbers

jgfujtf

Two solutions immediately spring to mind:Run over all the numbers in the range and if the number is even print it;run over the numbers starting with the first even number in the range using a step of 2 (so that only even numbers are considered) and print the numbers.

You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.

102

Yes, yes, please do.

Reference:cprogramming-bd.com/c_page2.aspx# divisible

#include(stdio.h) int main ()

printf ("%d", 51*350);

An algorithm to find the even numbers between 1 and 100, in C# //This will hold the resultsList evenList = new List();for (int i = 1; i

For i = 66 to 84 step 2 : print i : next : end PROGRAM TO FIND THE FIRST ONE HUNDRED EVEN NUMBERS FOR NUM = 2 TO 100 STEP 2 PRINT NUM, NEXT NUM END

Sum = 0 For N = 1 to 10 Sum = Sum + 2*N Next N Print Sum

People also asked