In this blog post, we are covering another question of C which is asked in every university exams and this is very easy for students and sometime students find it very difficult to perform such questions in examination hall. But nothing to worry I have explained this question very well in this post.
Write an algorithm and draw flowchart to print first n even natural numbers and find their sum?
- Start
- Read the numbers from user and store it in a variable.
- Now, we will use for loop and inside the loop modulo operator will skip the odd numbers.
- All the even numbers will be added to another variable for ex : sum.
- Once the loop is over, print the value of sum.
- Stop