Question: Write a Java program that will output the sum of all numbers divisible by two or divisible by three between 0 and an inputNumber read

  1. Write a Java program that will output the sum of all numbers divisible by two or divisible by three between 0 and an inputNumber read from the user. Assume a variable called int inputNumber contains the input value.

Eg: inputNumber = 8 output: 23 (since 2, 3, 4, 6, 8 are divisible by 2 or 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!