Question
Question 2
nter cost of each 1tem seperated bycespace Enter zero when you are done: 1 5687 Total cost is: $27 ndter dollar amount: $100
0 0
Add a comment Improve this question Transcribed image text
Answer #1

class Main{

public static void main(String args[]){

int sum =0

for(i=2;i<100;i++){

// every integer non divisble by two is odd

if(i%2!==0 && i%3==0) // this checks for odd number as well as divisible by 3

sum= sum +i;

}

System.out.println(sum);

}

}

Add a comment
Know the answer?
Add Answer to:
Question 2 nter cost of each 1tem seperated bycespace Enter zero when you are done: 1...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 2 Write a program to generate a table of conversions from Fahrenheit to Celsius for...

    Question 2 Write a program to generate a table of conversions from Fahrenheit to Celsius for values from 0 degrees F to 100 degrees F. Print a line in the table for each 5-degree change. Use a while loop in your solution. 1) re,-(TCF)-32) x 5/9 Write a program to generate a table of conversions from Fahrenheit to Kelvin for values from 0 degrees F to 200 degrees F. Allow the user to enter the increment in degrees Fahrenheit between...

  • 1) What are the two hypotheses of this experiment? What are you predictions for each hypotheses...

    1) What are the two hypotheses of this experiment? What are you predictions for each hypotheses & briefly describe how you will test the given hypothesis and the one you generated. 2) What is a histogram AND why is it used for this lab instead of just plotting each individual's data? 3) Does the multi-year TRC (total ridge count) support each hypothesis? (explain your answer in terms of the shape and the position of the curve.) 4) What might account...

  • Copy the following java codes and compile //// HighArray.java //// HighArrayApp.java Study carefully the design and...

    Copy the following java codes and compile //// HighArray.java //// HighArrayApp.java Study carefully the design and implementation HighArray class and note the attributes and its methods.    Create findAll method which uses linear search algorithm to return all number of occurrences of specified element. /** * find an element from array and returns all number of occurrences of the specified element, returns 0 if the element does not exit. * * @param foundElement   Element to be found */ int findAll(int...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT