how to solve the very first question? to find sum of even numbers from 1-N?
Flowchart assignment doubt
Make a for loop running from 2 to n. Increment value in the loop must be +2
Maintain a sum variable that will store the sum of even numbers while looping through .
for(i=2; i<=n; i+=2)
{
/* Add current even number to sum */
sum += i;
}
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.