Question: Java program beginning and please use while loop not use for loop Write a method, printFactors , which takes one positive integer n (>> 2)

Java program beginning and please use while loop not use for loop

Write a method, printFactors, which takes one positive integer n (>> 2) and prints all factors of n that are greater than or equal to 2 including itself. You may assume that the parameter, n, is guaranteed to be greater than or equal to 2.

 E.g., printFactors(10) prints 2 5 10. printFactors(19) prints 19. printFactors(30) prints 2 3 5 6 10 15 30. 

Write a method, sumEvenDigits, which takes one postive integer parameter, n, and returns the sum of all even digits in n.

 E.g., sumEvenDigits(1032) returns 2 (0 + 2). sumEvenDigits(240) returns 6 (2 + 4 + 0). sumEvenDigits(123456) returns 12 (2 + 4 + 6). 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!