Results 1 to 10 of 19
Hybrid View
-
6th Oct 2011, 01:19 PM #1OPBanned
^ Thank you so much gaurav its perfect.. well I have a new problem bro our professor said "Make a nested loop, that will prints out All Even numbers in in 1-50, and when it goes to 51-100 it prints out odd numbers"
basically when its still 1<50 it will prints out 2,4,6,8..50 and when its 51-100 it prints out 51,53,55,57,59..99..
Ive tried this so far..
Code:public class oddeven { public static void main(String[] args){ System.out.println("Even numbers: "); for(int a=1;a<=50;a++){ if(a%2 == 0){ System.out.println(a); } } System.out.println("Odd numbers: "); for(int a=51;a<=100;a++){ if(a%2 == 1){ System.out.println(a); } } } }
conrey Reviewed by conrey on . [JAVA} Need help in a Nested Loop Any1 can help me in java that can will have an output like these please.. 54321 4321 321 21 1 Rating: 5
Sponsored Links
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
themaPoster - post to forums and...
Version 5.38 released. Open older version (or...