Question: Please answer both questions using java. Chapter 2, Java Basics Page 23 (b) Write a program which reads an arbitrary integer. It then prints the

Please answer both questions using java.
 Please answer both questions using java. Chapter 2, Java Basics Page

Chapter 2, Java Basics Page 23 (b) Write a program which reads an arbitrary integer. It then prints the integer if it is even; otherwise it prints the number one less than the integer. For example, If 10 is read, 10 is printed because it is even, but if 9 is read, 8 is printed, since 8 is an even number one less than 9 (c) Write a program which reads an arbitrary integer. It then prints the closest number divisible by three which is equal to or greater than the original integer. For example, if 10 is read, 12 is printed, since it is the next highest integer divisible by 3. If 15 is read, then 15 is printed, since it is divisible by 3

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!