Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Jaweria

Can anyone help me here with java problem?

  • one year ago
  • one year ago

  • This Question is Closed
  1. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 2

    hi, yes.

    • one year ago
  2. Jaweria
    Best Response
    You've already chosen the best response.
    Medals 0

    oh really Can you please

    • one year ago
  3. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 2

    you should post your question if you want help.......

    • one year ago
  4. Jaweria
    Best Response
    You've already chosen the best response.
    Medals 0

    Yes I have two questions. First question is this: Write a for loop that prints in ascending order all the positive integers less than 200 that are divisible by both 2 and 3, separated by spaces. The answer that I got for this question is this: int i; for (i=0;i<200; i++) { if(i%2==0 i%3==0) { System.out.println [i]; } } But it says that something is wrong can you please check it for me? My second question is this: 1.05: Range Write in a Java program to read two integers and display the number of integers that lie between them, including the integers themselves. For example, there are four integers are between 3 and 6: 3, 4, 5, and 6. Input Notes: The input consists of two integers typed at the console. Output Notes (Prompts and Labels): The program's first line of output is: My answer that I got is this: Range import java.util.Scanner; class { public static void main(String args[]) { int n1,n2; Scanner in = new Scanner(System.in); System.out.println('a'); n1 = in.nextInt(); System.out.println('b'); n2 = in.nextInt(); for(int i=n1;i<n2;i++) //print i } } But Its telling me that its wrong.

    • one year ago
  5. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 2

    if(i%2==0 i%3==0) { System.out.println [i]; } if(i%2==0 || i%3==0) { System.out.println [i]; }

    • one year ago
  6. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 2

    What are your errors for the second one? All I see is that it should be <=n2?

    • one year ago
  7. Jaweria
    Best Response
    You've already chosen the best response.
    Medals 0

    But I dont get it what is my error for the first one?

    • one year ago
  8. Jaweria
    Best Response
    You've already chosen the best response.
    Medals 0

    what I need to fix in there?

    • one year ago
  9. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 2

    if(i%2==0 i%3==0) if(i%2==0 || i%3==0)

    • one year ago
  10. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 2

    || = or && = and

    • one year ago
  11. Jaweria
    Best Response
    You've already chosen the best response.
    Medals 0

    how am I going to get that two parallel lines

    • one year ago
  12. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 2

    shift + \ <- above enter

    • one year ago
  13. Jaweria
    Best Response
    You've already chosen the best response.
    Medals 0

    Now its giving me an error of this [i]

    • one year ago
  14. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 2

    System.out.println [i]; System.out.println([i]);

    • one year ago
  15. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 2

    going to bed now.

    • one year ago
  16. Jaweria
    Best Response
    You've already chosen the best response.
    Medals 0

    ok thanks though

    • one year ago
  17. rsmith6559
    Best Response
    You've already chosen the best response.
    Medals 0

    Square brackets are used syntactically for indexes into arrays, maps, etc. They have to be used with the name of the structure: foo[ i ] System.out.println is a method of the System object. Function notation uses parentheses, so it would be: System.out.println( i );

    • one year ago
  18. Jaweria
    Best Response
    You've already chosen the best response.
    Medals 0

    i tried this but still giving me an error.

    • one year ago
  19. rsmith6559
    Best Response
    You've already chosen the best response.
    Medals 0

    What is the error?

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.