|
-
August 5th, 2011, 12:43 AM
#2
Re: Learning Java, Help Please
Let's say you can write a progran that prints the integers between 1 and 100.
Now to check whether an integer i is a multiple if 3 you can use the modulo operator % like,
if (i%3 == 0) {
// Fizz
}
You can check for multiples of 5 analogously. And to check whether both 3 and 5 multiplicity apply you can combine the tests for each using the and operator &&.
Last edited by nuzzle; August 5th, 2011 at 12:55 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|