# Thread: Need to look for only 5 and 10's

1. Member
Join Date
Nov 2009
Posts
2
Rep Power
0

## Need to look for only 5 and 10's

I'm writing a program that gives awards based on years served, given the staff has been employed for 5, 10, 15, 20, etc. years they get a plaque with the number of years employed. anyone got any hints or tips on a method I could write which would compare/decipher whether or not the number is a 5's or 10's number.

2. Use the mod operator (%) to see if an int is divisible by 5. If so, then number % 5 will equal 0.

Much luck and welcome to the forum!

3. Member
Join Date
Nov 2009
Posts
2
Rep Power
0
thanks much :)

4. if ((yearsemployed % 5 == 0 )|| (yearsemployed % 10 == 0))
write plaque for yearsemployed

5. Member
Join Date
Oct 2009
Location
Rotterdam
Posts
52
Rep Power
0
Originally Posted by aaroncarpet
if ((yearsemployed % 5 == 0 )|| (yearsemployed % 10 == 0))
write plaque for yearsemployed
Why? what's the "(yearsemployed % 10 == 0)" part good for? If the first condition of an or operator is true, then it won't even evaluate the second.

BTW: Sometimes it seems the beginners and advance sections switch sides.

6. ## no need for remainder 10

I realized the same thing as I was going to bed. the problem was I was over focused on his title 5's and tens. I am working on a huge prime number project. So I was going to sleep thinking duh? 10 is divisible by five. I am not a senior programmer but I do have alot of experience with j2se. so maybe I am a beginner. I am new to this forum stuff and I need to learn to think before I type. My apologies

what about the employees with 6-9yrs 11-14 etc maybe they should have plaques 5+yrs 10+...I think the people with in between years long term service to the company will feel spited.....but i don't work there
Last edited by aaroncarpet; 11-14-2009 at 08:55 PM. Reason: other thoughts

#### Posting Permissions

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