Computer Science, asked by srijitadey2106, 4 months ago

Print the sum of all even numbers between 1 to n. n should be given by the user.​

Answers

Answered by ItzRosyGirl
2

\huge\tt\underline\purple{\underline {Unnecessary}}

Answered by jubynbobby
0

Answer:

To find sum of even numbers we need to iterate through even numbers from 1 to n. Initialize a loop from 2 to N and increment 2 on each iteration. The loop structure should look like for(i=2; i<=N; i+=2) . Inside the loop body add previous value of sum with i i.e. sum = sum + i .

Similar questions