Question: Write a Java program with loop that ask user to enter a positive integersn.The program should display all the even numbers from 2 to n

Write a Java program with loop that ask user to enter a positive integersn.The program should display all the even numbers from 2 to n and also display the sum of all even numbers from 2 tonin the following format.For example, if the value ofnis 9, you program should display

2+4+6+8 = 20

Sample input/output

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!