Why Isn't the for loop executing?

here's the code,the for loop isn't executing,can anyone trouble shoot?
import acm.program.ConsoleProgram;
public class AddIntegerList extends ConsoleProgram {
public void run(){
     for(int c=0;c<5;c++);{
     println("This is a programe to divide 2 numbers");
double i = readDouble("enter num1: ");     
double x = readDouble("enter num2: ");
double ans = i/x;
println("The answer to your division Is "+ans+ "");
          } by the way,this Is the first piece of java code that I have written. :D
Edited by: Parastar on Oct 21, 2009 4:20 AM

I dont think there should be a semicolon at the end of this
for(int c=0;c<5;c++); Remove it and try running the program.
Edited by: A.J.Bharanidharan on Oct 21, 2009 4:53 PM

Similar Messages

  • Why won't for loop execute?

    Can anyone tell me why this for loop won't execute in "Security System".  Basically I was practicing for the  CLD exam by writing the "Security System" practice exam.  I wanted to try the Event-Driven State Machine with a queue.  My problem is that in the "Check Alarm", "Check Bypass", and "Check Tamper" states, I have a for loop which is indexed with 4 - 6 element arrays.  The for loop will not execute 6 times.  It won't even execute once.  It just skips over the for loop and outputs all boolean falses and zeros for the numeric values.  Is this a Labview glitch of some sort?
    Thanks for any replies.
    Matt Koebel
    Attachments:
    Security System.zip ‏108 KB

    tst wrote:
    Without looking at the code, my guess would be that one of the indexing inputs into the loop is 0.
    More precisely ".. is an array of size zero.
    (1) Go to yout three boolean arrays and click on the 6th element to make the arrays size=6 with all FALSE. now make current values default and save the VI.
    (2) You also need to wire the boolean arrays across all event cases  to ensure the current values are kept in the shift register. RIght now a change in one array resets the others to an empty array again.
    (3) now initialize a boolean array containing six FALSE and initialize the shift registers with it. 
    Message Edited by altenbach on 10-22-2008 11:55 AM
    LabVIEW Champion . Do more with less code and in less time .

  • Whenever I go to preview a song in itunes, the song with play out for about 10 seconds and then stop. Why isn't the song previews working? How can I fix this? I tried updating my itunes and it didn't work.

    Whenever I go to preview a song in itunes, the song with play out for about 10 seconds and then stop. Why isn't the song previews working? How can I fix this? I tried updating my itunes and it didn't work. I use windows 7. Thanks!

    Try:                           
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable
    - Try on another computer                            
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar                                     

  • Why isn't the App Store and iTunes a choice for an app on my mini?

    Why isn't the App Store and iTunes a choice for an app on my mini?

    Either they've been moved to another home screen or dropped in a folder, in which case doing a search or resetting the Home Screen layout (Settings/General/Reset) should bring them up, or they've been turned off in General/Restrictions.
    Regards.

  • HT1338 Why isn't the file size displayed for software updates in the App Store?

    Why isn't the file size displayed for software updates in the App Store?
    My only internet connection is a tether to my iPhone.
    My limited bandwidth forces me to manage my data consumption - I am forced to "google" the file size of the software update so I can decide if I have the headroom in my data plan to take advantage of the update.

    If you click on the name of the Application in your Updates Available list,
    it will take you to the update Imformation for that App.

  • How to code a parallel 'for loop' and 'while loop' where the while loop cannot terminate until the for loop has finished?? (queues also present)

    I've attached a sample VI that I just cannot figure out how to get working the way that I want.  I've labeled the some sections with black-on-yellow text boxes for clarity during the description that follows in the next few sentences.  Here's what I want:
    1) overall -- i'm intend for this to be a subVI that will do data acquisition and write the data to a file.  I want it to use a producer/consumer approach.  The producer construct is the 'parallel for loop' that runs an exact number of times depending on user input (which will come from the mainVI that is not included).  For now I've wired a 1-D array w/ 2 elements as a test case.  During the producer loop, the data is acquired and put into a queue to be delt with in the consumer loop (for now, i just add a random number to the queue).
    2) the consumer construct is the 'parallel while loop'.  It will dequeue elements and write them to a file.  I want this to keep running continuously and parallel until two conditions are met.
          i. the for loop has finished execution
          ii. the queue is empty.
       when the conditions are met, the while loop will exit, close the queue, and the subVI will finish. (and return stuff to mainVI that i can deal with on my own)
    Here's the problems.
    1)  in the "parallel for loop" I have a flat sequence structure.. I haven't had time to incorporate some data dependency into these two sequential sections, but basically, I just care that the "inner while loop" condition is met before the data is collected and queued.  I think I can do this on my own, but if you have suggestions, I'm interested.
    2)  I can easily get the outer for and while loops to run sequentially, but I want them to run in parallel.  My reasoning for this is that that I anticipate the two tasks taking very different amounts of time. .. basically, I want the while loop to just keep polling the queue to get everything out of it (or I suppose I could somehow use notifiers - suggestions welcome)...  the thing is, this loop will probably run faster than the for loop, so just checking to see that the queue is empty will not work... I need to meet the additional condition that nothing else will be placed in the queue - and this condition is met when the for loop is complete. basically, I just can't figure out how to do this.
    3) for now, I've placed a simple stop button in the 'parallel while loop', but I must be missing something fundamental here, because the stop button is totally unresponsive.  i.e. - when I press it, it stays depressed, and nothing happens.
    suggestions are totally welcome!
    thanks,
    -Z
    Attachments:
    daq01v1.vi ‏59 KB

    I'd actually like to add a little more, since I thought about it a bit and I'm still not quite certain I understand the sequence of events...
    altenbach wrote:
    zskillz wrote:
    So i read a bit more about the 'dequeue element' function, and as I understand it, since there is no timeout wired to the dequeue element function, it will wait forever, thus the race condition I suggested above can never happen!
    Yes, you got it!
    As I've thought about it a bit more, there's a few things that surprise me... first, the reason the 'dequeue element while loop' errors is not because there's nothing in the queue, it's becaues the queue has been released and it's trying to access that released queue...   However the problem I have is this --- Even though there's no timeout wired to the dequeue element, I still would think that the while loop that contains it would continue to run at whatever pace it wanted -- and as i said before.. most of the time, it would find that there is nothing to dequeue, but once in a while, something is there.  however, it seems that this loop only runs when something has been enqueued.  the reason I say this is illustrated in the next code sample MODv2 that's attached below.  I've added a stop button to the "queue size while loop" so the program runs until that is pressed.  I've also added a simple conditional in the "dequeue while loop"  that generates a random number if it a button is pressed... but this button is totally non-responsive... which means to me that the "dequeue while loop" isn't actually continuously running, but only when an element is added to the queue.  this still seems almost like the 'dequeue while loop" waits for a notifier from the queue telling it to run.  can you explain this to me? because it is different from what I expect to be happening.
    rasputin wrote:
    I tried to open your VIs but it doesn't work. LV
    is launched, the dialog box (new, open, configure...) opens and then...
    nothing. Not even an error message. I guess it isn't a problem of LV
    version or a dialog box would appear saying this. Could you, please,
    send a image of the code?
    Thanks,
    Hi Rasputin, I'm using LV8.  I assume that was your problem, but who knows.  I've attached a pic of of altenbach's solution since it's what I needed.
    thanks
    -Z
    Message Edited by zskillz on 10-20-2006 11:49 AM
    Attachments:
    daq01v1MODv2.vi ‏63 KB
    daq01v1MODpic.JPG ‏116 KB

  • Why isn't the plugin checker working anymore?

    I check for updates to my plugins very often. The Plugin Check page has been saying that all my plugins are up to date. However, twice now I've clicked the button to check anyway, and found that a plugin was not up to date after all. Why isn't the Plugin Check page detecting when my plugins need updating?

    I don't know what you guys have been doing at Mozilla but you've ruined a decent product!

  • Why isn't the apogee working

    Downloaded new version of garage band and now my apogee isn't working

    webmail-user wrote:
    I get annoying spam in the Spam Detector from a sender that I will refer to as XYZ for this question. Using Settings/Email Settings/Filters, I added a new filter "If From Contains XYZ delete" and saved the new filter. Today I got another spam in the Spam Detector from the same XYZ sender. Why isn't the filter causing this email to be automatically deleted? Thanks for any suggestions.
    I think that the Spam Detector runs before your custom filters, and custom filters only work on the inbox folder. If Spam Detector moved it from the inbox before the filters were run, then the filter wouldn't delete it.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • Why isn't the filter working?

    I get annoying spam in the Spam Detector from a sender that I will refer to as XYZ for this question. Using Settings/Email Settings/Filters, I added a new filter "If From Contains XYZ delete" and saved the new filter. Today I got another spam in the Spam Detector from the same XYZ sender. Why isn't the filter causing this email to be automatically deleted? Thanks for any suggestions.

    webmail-user wrote:
    I get annoying spam in the Spam Detector from a sender that I will refer to as XYZ for this question. Using Settings/Email Settings/Filters, I added a new filter "If From Contains XYZ delete" and saved the new filter. Today I got another spam in the Spam Detector from the same XYZ sender. Why isn't the filter causing this email to be automatically deleted? Thanks for any suggestions.
    I think that the Spam Detector runs before your custom filters, and custom filters only work on the inbox folder. If Spam Detector moved it from the inbox before the filters were run, then the filter wouldn't delete it.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • Why isn't the edit button not showing in my ESX24 sampler?

    why isn't the edit button not showing in my ESX24 sampler?

    Is that during installation when you see the two icons.. the one on the left looking like a Garageband guitar icon, the one on the right like the Logic Pro platimum record icon?
    Yes.. that one.. with the choice to click on which option you want/are coming from...
    p.s. I'll probably aquire a Mac Mini this fall then upgrade.... I mean repurchase!
    I think I managed to grab one of the last of the 2011 refurb'ed MMS's.... at that super low price Apple were selling them for... before they bumped it up and now, they seem to have none left at all at any price
    However, just in case, I have found this site really useful at keeping track of Apple's refurb stock... and pricing
    http://www.refurb.me/us/

  • [svn:bz-trunk] 21048: moving the locking of MessageService. subscribeLock one level up in the for loop.

    Revision: 21048
    Revision: 21048
    Author:   [email protected]
    Date:     2011-04-08 06:47:21 -0700 (Fri, 08 Apr 2011)
    Log Message:
    moving the locking of MessageService.subscribeLock one level up in the for loop.
    in case of multiple subscribers, we only lock once
    checkintests pass
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/services/MessageService.java

    I have finally been able to replicate the behavior that you are seeing on another computer once the image was large enough.  Here are a few notes about this behavior:
    First. The UI only slows down when the images are large, 16 bit images.  The reason why this is unique to 16 bit images is that they can only be displayed on the front panel as 8 bit images.  The workaround that Weiyuan suggested to change the 16 bit display mapping hints towards the root of the problem...that any time a mouse runs over the indicator, Windows asks the entire image to re-draw (having a separate indicator overlapping the image will create the same behavior).  With a 16 bit image, not only does the image have to re-draw on the screen but the 16 bit pixels need to be mapped to 8 bits.  When setting the 16 bit display mapping to Full Dynamic, this requires mor computation/pixel than 90% dynamic or one of the other mapping schemes.
    This is expected behavior if your program is running and you're trying to display a large 16 bit image.  To fix this behavior there are a couple options:
    Change the 16 bit display mapping to something other than full dynamic.  You can choose which 8 bits to display or if you want to map the bits. 
    Resize the image just for viewing purposes on your front panel (since you aren't going to view every single pixel of you image on the screen). You can use the IMAQ Resample.vi to do this.  This will allow you to take your 1500x1500 pixel image and only display a 500x500 pixel version.
    If you are interested in viewing small details of the large image, consider just displaying a smaller region of interest at a time.
    Let me know if any of these solutions work for you.  Good luck on your application.
    Zach C.
    Field Engineer
    Greater Los Angeles

  • The demand of my application is that i can not replace for loop with a while loop.because i need fixed number of iterations and as far as i know fixed iterations could be only with possible with the for loop.

    the demand of my application is that i can not replace for loop with a while loop.because i need fixed number of iterations and as far as i know fixed iterations could be only with possible with the for loop.
    your recommended second option that i could add true/false case.
    this true/false case must be inside the for loop or outside the for loop?if this case is inside the for
    loop, how can i send stop command from outer while
    loop?
    more over do you have any example for this please?
    thanks"

    You can execute a fixed number of iterations using a while loop by comparing the iteration count to the number of iterations you want and wiring the output of that comparison (e.g. Less Than or Equal To) to the continue (or stop) terminal of your while loop. Which comparison you use depends on personal preference, where you wire the desired count and the interation count, and whether you're using the while loop as Continue if True or Stop if True.
    Ben gave you step-by-step instructions in response to your previous question. Look here for Ben's response.
    Ben's response looks pretty good and detailed to me. It certa
    inly deserved better than a 1-star rating.

  • Why isn't the Youtube app on my iPod?

    Why isn't the Youtube app on my iPod?

    I also think that it was a mistake for them to take away the Built in YouTube Application but you could always try to download it from the App Store because their is now an YouTube app i have tried it and it works fine but it is just not the same as the Built in one
    Hope this solves your issue
    Hope they bring back the Built in YouTube App on the next IOS Update.
    Best of Luck

  • Why isn't the radio tuning service working on itunes?

    Why isn't the radio tuning service working on itunes? I get an error message on all of our Macs.

    Maybe one of the 300+ posts about this in the last few days has the answer.  Browse the forum.
    If you wish to, you can report to Apple.
    http://www.apple.com/feedback/itunesapp.html

  • Why isn't the iMessage working on my phone? Up until 1:45pm today it was fine, but now it isn't working.

    Why isn't the iMessage on my iPhone 4s working? Up until about 1:45PM today it was working just fine but now it sends it as a text message. I have tried everything in the setting but it still is not working. Any tips would be great! Thanks!

    It should be back up now, they had a system outage. Reset your iPhone.

Maybe you are looking for