Results 1 to 10 of 19
Threaded View
-
10th Oct 2011, 09:41 AM #19You can call me G
He wants to print odd numbers.. so the remainder after dividing by 2 should be one.. He's correct there..
Try this:
Code:/** * Prints the above mentioned pattern * * @author Gaurav <Gaurav@besthostingforums.com> * @version 1.0 */ public class oddeven { public static void main(String[] args){ for(int i = 1; i <= 100; i++) { if(i <= 50 && i % 2 == 0) { System.out.println(i); } else if(i > 50 && i % 2 == 1){ System.out.println(i); } } } }
My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Java stinks: Turn off your Java browser plugin
By Loget in forum General DiscussionReplies: 37Last Post: 5th Sep 2012, 07:40 AM -
[PHP] Need help to loop true the results
By AndroidApps in forum Web Development AreaReplies: 6Last Post: 5th Feb 2012, 09:56 AM -
Php Loop Prob
By Chris2k in forum Web Development AreaReplies: 1Last Post: 16th Jan 2012, 02:00 PM -
What's the biggest forum out there? Been out of the loop..
By wildfire95 in forum Webmasters, Money MakingReplies: 3Last Post: 7th May 2011, 11:28 AM -
Redirect loop?!?!
By GeeZus in forum Technical Help Desk SupportReplies: 4Last Post: 9th Jun 2009, 04:36 AM
themaCreator - create posts from...
Version 3.52 released. Open older version (or...