Results 1 to 10 of 10
 10062012, 02:18 AM #1Member
 Join Date
 Sep 2012
 Posts
 68
 Rep Power
 0
Need help with finding the sum of a bunch of numbers.
Hey guys pretty much what i am doing is setting up a loop to add 3 in incriments of three to 9669. well the easy part was making the loop to add three to three untill it gets to 9669 but i have no idea how to do that. help please
Java Code:public class Prog152a { public static void main(String args[]) { int b = 3; int c = 3; for(int a = 3; a <= 3223;a++){ b =b + c; System.out.println(b + " "); } } }
 10062012, 02:27 AM #2Member
 Join Date
 Sep 2012
 Posts
 44
 Rep Power
 0
Re: Need help with finding the sum of a bunch of numbers.
Could you explain in a different way what you want? Because i can't understand what you (my fault).
 10062012, 02:31 AM #3Member
 Join Date
 Sep 2012
 Posts
 68
 Rep Power
 0
Re: Need help with finding the sum of a bunch of numbers.
ok so as you can see by running the program *if you do or dont ill explain anyway* it prints out numbers from 3 to 9669 in increments of three, i need to find out how to add all of those numbers up and print out the sum

Re: Need help with finding the sum of a bunch of numbers.
All you need to do is declare a sum variable before the loop, and add b to the sum variable.
 10062012, 02:45 AM #5Member
 Join Date
 Sep 2012
 Posts
 44
 Rep Power
 0
Re: Need help with finding the sum of a bunch of numbers.
I was about to say that. But unfortunately i did not understand the task because of my not so great english vocabulary.
 10062012, 02:53 AM #6Member
 Join Date
 Sep 2012
 Posts
 68
 Rep Power
 0

Re: Need help with finding the sum of a bunch of numbers.
 10102012, 04:22 AM #8Senior Member
 Join Date
 Oct 2012
 Posts
 176
 Rep Power
 4
Re: Need help with finding the sum of a bunch of numbers.
so set a int like that c one you got there to be the sum. Then make the sum = the sum plus b.
 10252012, 09:57 AM #9
Re: Need help with finding the sum of a bunch of numbers.
@sjicho: We're all here to learn, and posting a complete code solution doesn't help anyone to learn, so I've deleted your post.
Please also go through Guide For New Members and BB Code List  Java Programming Forum
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
 10252012, 10:08 AM #10Member
 Join Date
 Oct 2012
 Location
 NE Iowa
 Posts
 11
 Rep Power
 0
Similar Threads

Finding the Min and Max of numbers
By Alexis_DB in forum New To JavaReplies: 6Last Post: 09302012, 12:58 PM 
Finding minimum and maximum of 'n' numbers...please help!
By snw19 in forum New To JavaReplies: 8Last Post: 03262011, 12:38 AM 
Random Numbers  finding least value
By collwill in forum New To JavaReplies: 16Last Post: 03082011, 01:34 AM 
Problem getting numbers from user and finding smallest two numbers
By radhi16 in forum New To JavaReplies: 11Last Post: 01142011, 07:36 PM
Bookmarks