| | |
% problem
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Apr 2004
Posts: 573
Reputation:
Solved Threads: 5
Hello,
I am having a problem with %. I am trying to find all the years from 1628 to 2005 that are divisible by 15, so I did this:
So the way i am thinking of this is that year will be divided by 15 and if it is divided evenly then it would have a remainder of 0. So is there something wrong with the way I am using the % or is it something else that I am not seeing.
TY
I am having a problem with %. I am trying to find all the years from 1628 to 2005 that are divisible by 15, so I did this:
Java Syntax (Toggle Plain Text)
if((year % 15 == 0) || (year % 100 == 0) || (year == 2005)){ System.out.println("Print something"); }
So the way i am thinking of this is that year will be divided by 15 and if it is divided evenly then it would have a remainder of 0. So is there something wrong with the way I am using the % or is it something else that I am not seeing.
TY
all the years from 1628 to 2005 .... hmmm, I would definately look into a for loop for this one
sounds like a homework problem to me
sounds like a homework problem to me
![]() |
Similar Threads
- Problem with Windows Update and WinXP (Web Browsers)
- Installing Windows 98 On VMware. Floppy problem (Windows 95 / 98 / Me)
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP)
- Redhat Linux 6.2 - ipop3d problem? (*nix Software)
- Problem with T720 (Cellphones, PDAs and Handheld Devices)
- Connection Problems (Networking Hardware Configuration)
- Encoding (Unicode) problem in IE 6.0 (Web Browsers)
- .htaccess mod_rewrite problem (Linux Servers and Apache)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
Other Threads in the Java Forum
- Previous Thread: how to run applets?
- Next Thread: image via java
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary bluetooth character chat class classes client code component consumer csv database desktop draw eclipse error event exception fractal ftp game givemetehcodez graphics gui html ide image input integer j2me japplet java javaarraylist javaee javaprojects jmf jni jpanel julia linked linux list loop mac map method methods mobile netbeans newbie objects online oracle oriented panel print printf problem program programming project projects properties recursion replaydirector reporting researchinmotion robot rotatetext rsa scanner screen se server set size sms sort sql string swing template test threads time tree ubuntu windows working





