write a program to find the sum of all even number up to given number
Answers
Answered by
1
Answer:
printf("Sum of all even numbers = %d\n", even_sum);
User must first enter the number upto which he/she wants to find the sum and is stored in the variable num.
Using for loop take the elements one by one from 1 to num.
Use if,else statement for each element to find whether it is odd or even by dividing the element by 2.
Explanation:
Similar questions