Results 1 to 4 of 4
  1. #1
    Limuh is offline Member
    Join Date
    Aug 2008
    Posts
    1
    Rep Power
    0

    Default Computing the sum

    hello,

    i want to get the sum of the arguments when i enter myStart = 1 and myEnd =10 the sum will be 55. i want to use looping statement with Scanner. Please help. :)

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    Not clear,
    freedom exists in the world of ideas

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    Do some research with a search for examples of using Scanner and for( loops. Then write some code and come back with the code and your questions.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    You have to try something first. This is not a big task at all. Read some basis about scanner and loops. I'll give some guide line to you.

    First using scanner object collect the starting and ending values. Store them in two variables.

    Then loop from starting value to ending value by incrementing the starting value by one. At the same time add the incremented starting value added with all previous values.

    I hope it's clear to you. Try something first, then we can help you.

Similar Threads

  1. Computing prime numbers in Java
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-12-2008, 08:39 PM
  2. Replies: 0
    Last Post: 04-12-2008, 08:39 PM
  3. distributed computing in java
    By pushpik in forum Advanced Java
    Replies: 0
    Last Post: 03-31-2008, 06:50 PM
  4. Computing Fibonacci numbers recursively
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-22-2008, 08:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •