Results 1 to 4 of 4
Thread: Need help with loops
- 10-03-2012, 04:14 AM #1
Member
- Join Date
- Sep 2012
- Posts
- 68
- Rep Power
- 0
Need help with loops
Hey guys i need help with loops for class. Pretty much i am trying to show some one their hourly pay in increments of 4. im having a tough time making it go up by four, heres my code.
its not much but now its going up by one each time i need to make it go up by four.Java Code:public class Hourlypay { public static void main(String args[]) { for (int p = 4; p <= 40; p++) { System.out.println(p + " "); } } }
- 10-03-2012, 04:49 AM #2
Member
- Join Date
- Sep 2012
- Location
- Maryland, USA
- Posts
- 14
- Rep Power
- 0
Re: Need help with loops
Go back and look at this line:
How can you make it increment by 4?Java Code:for (int p = 4; p <= 40; p++)
- 10-03-2012, 07:20 AM #3
Member
- Join Date
- Sep 2012
- Location
- Australia
- Posts
- 12
- Rep Power
- 0
Re: Need help with loops
Java Code:for(int i = 0; i < 40; i = i + 4)
- 10-03-2012, 08:15 AM #4
Similar Threads
-
Help with loops!
By jrelvi23 in forum New To JavaReplies: 9Last Post: 09-04-2012, 01:36 PM -
[Semi-Beginner] (nested loops) What's wrong with my code? (nested loops)
By Solarsonic in forum New To JavaReplies: 20Last Post: 03-22-2011, 04:02 AM -
Help with while loops
By tgwinford in forum New To JavaReplies: 1Last Post: 03-05-2011, 11:03 AM -
Help with Loops
By Spyderpig in forum New To JavaReplies: 10Last Post: 02-17-2011, 08:10 AM -
While Loops, need a bit of help.
By Keno777 in forum New To JavaReplies: 7Last Post: 10-30-2009, 08:24 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks