Write a program to accept a number and display sum of its even factor.
Answers
Answered by
1
Answer:
In this article, we will learn about the solution to the problem statement given below.
Problem statement − We are given a number, we need to display the sum of all even factors of the number.
Approach
We check whether the number is odd, then there are no even factors, so return 0.
If the number is even, we go through the computation. All other terms except 20 multiply to produce an even factor sum.
To remove all odd numbers in even factor, we ignore the 20 which is 1. After this step, we only got even factors. Note that 2 is the only even prime available to us.
Similar questions
Social Sciences,
1 month ago
Math,
1 month ago
Science,
1 month ago
Math,
3 months ago
English,
3 months ago
Accountancy,
9 months ago