CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #2
    Join Date
    May 2009
    Posts
    2,413

    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
  •  





Click Here to Expand Forum to Full Width

Featured