Finding the minimum with a for statement

Ok so Ive got this program and I need to find the minimum value from the 10 values that are entered by a user, my problem is I cant figure out to initialize the variable minNum, Im not sure how to do it with a for loop, if I set it to zero, then zero will always be the minimum, so Im not sure how to make it so it takes the first value as the minimum then compares each value entered after that to see if the value is smaller, and I have to use a for loop for this problem, my professor specified which loop to use, so heres the code:
import java.util.Scanner;
public class Exercise52Chapt6
  public static void main(String[] args)
            Scanner scan = new Scanner(System.in);
              int minNum;  // stores the minimum of 10 numbers
                       int number;  // stores the current input
                       for ( int i = 1; i <= 10; i++ )
                System.out.print( "Enter an integer > " );
                               number = scan.nextInt( );
                    if(number < minNum)
                    minNum = number;
          // process results by printing the minimum
          System.out.println( "The minimum is: " + minNum );
}

import java.util.Scanner;
public class Test
  public static void main(String[] args)
                Scanner scan = new Scanner(System.in);
                    int minNum=0;  // stores the minimum of 10 numbers
                      int number;  // stores the current input
                      for ( int i = 1; i <= 10; i++ )
                        System.out.print( "Enter an integer > " );
                            number = scan.nextInt( );
                            if(i==1){
                                minNum = number;
                                continue;
                            if(number < minNum)
                                minNum = number;
                // process results by printing the minimum
                System.out.println( "The minimum is: " + minNum );
}

Similar Messages

  • How do I find the screen with my personal iPod (my name's iPod) so I can download from my purchased or free songs/pods from my computer? My iPod has opened to that for 3 years and this week I can't find it: not on purchased page or on Apple store page.

    QUESTION from an American in India:
    How do I find the screen with my personal iPod (my name's iPod) so I can download from my purchased or free songs/pods from my computer? My iPod has opened to that for 3 years and this week I can't find it: not on purchased page or on Apple store page.

    See:
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

  • With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution, With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution

    With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution, With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution

    Actually your suggestions are the ones that i have tried. i have seen that you have tried to help others with this issue and the only one that i could find that said they found the problem said that it was an ilife update issue and it fixed it and i have no available updates. i know it has to do with something in photo stream because it happens when i create a new library and it is loading the photos but i get the message before i reach the maximum 1000 photos. so i've tried updating, new library(first backing up photos and then deleting them from iPhoto), reinstalling OSX many times, running disc utilities. I called Apple the first day i had this issue and i was the first person to call them for support with the retina display and i actually had it escalated to a senior advisor and we thought we fixed the problem but we did not. i am pretty fluent in dealing with troubleshooting these type of issues and this is the first time i'm reaching out to the community. i figured now that the retina has been out some time now that there would be an obvious answer to this issue. thanks for the quick reply.
    Bebers5

  • I purchased an ipad for my husband in 12/2011 - it was stolen last night and i can't find the receipt with insurance and warranty

    I purchased an ipad for my husband in 12/2011 - it was stolen last night and i can't find the receipt with insurance and warranty.

    The warraty doesn't cover lost or stolen.
    If the iPad was running iOS 7, the thief/finder will not ever be able to use it.
    iCloud: Find My iPhone Activation Lock in iOS 7
    http://support.apple.com/kb/HT5818
    Apple (and no one else) can not assist (with serial number or iCloud) in finding a lost or stolen iPad.
    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipadhttp://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    What to do if your iOS device is lost or stolen
    http://support.apple.com/kb/HT5668
    iCloud: Locate your device on a map
    http://support.apple.com/kb/PH2698
    iCloud: Lost Mode - Lock and Trace
    http://support.apple.com/kb/PH2700
    iCloud: Remotely Erase your device
    http://support.apple.com/kb/PH2701
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.phphttp://www.stolen-property.com/report-stolen-ipad.php
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.htmlhttp://www.ehow.com/how_7586429_stolen-ipad.html
    What NOT to do if your iPhone or iPad is lost or stolen
    http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st olen
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-numberhttp://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number
    iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number
    http://support.apple.com/kb/HT4061
     Cheers, Tom

  • HT4812 I recently fixed my computer and need to reinstall logic pro 9 but I can't find the booklet with my serial number, is there any other way I can get the serial number for logic pro 9 (box)?

    I recently fixed my computer and need to reinstall logic pro 9 but I can't find the booklet with my serial number, is there any other way I can get the serial number for logic pro 9 (box)?

    If you still have the receipt or other proof of purchase, you can ask Apple to send you the serial. Otherwise, bad luck mate.. Good news is, you can now buy Logic Pro 9 from App Store for just 199 USD

  • JSPDynPage : Cannot find the tag library descriptor for tagLib

    Hi,
    I'm working JSPDynPage and i have error in IDE at design time.
    i just created one JSPDynPage component. and an error is shown at the uri="tagLib"
    <%@ taglib uri="tagLib" prefix="hbj" %>
    The problem is that the word 'tagLib' is marked and has the hoovering text "Cannot find the tag library descriptor for tagLib". Why is this? Do I have to do add some dc dependency ? Or is there another cause for this problem?
    I am working with CE 7.2 .
    portalapp.xml
    <?xml version="1.0" encoding="utf-8"?>
    <application>
      <application-config>
        <property name="SharingReference" value="com.sap.portal.htmlb"/>
      </application-config>
      <components>
        <component name="GCPPURLJSP">
          <component-config>
            <property name="ClassName" value="com.cts.gc.GCPPURLJSP"/>
            <property name="SecurityZone" value="com.cts.gc/low_safety"/>
          </component-config>
          <component-profile>
            <property name="tagLib" value="/SERVICE/com.sap.portal.htmlb/taglib/htmlb.tld"/>
          </component-profile>
        </component>
      </components>
      <services/>
    </application>
    Best regards
    Pavan

    Hi Pavan,
    For using htmlb, you can use another tag library. Use the below code in your jsp
    <%@ taglib uri = "prt:taglib:tlhtmlb" prefix="hbj" %>
    And in portalapp.xml, replace the <property> of <component-profile> with the below line.
    <property name="tlhtmlb" value="/SERVICE/com.sap.portal.htmlb/taglib/htmlb.tld">
    Also, you may need to add the import statement for htmlb, if not done earlier -
    <%@ page import = "com.sapportals.htmlb.*" %>

  • Dont find the correct video drivers for my T61 + windows 7 ultimate + intel pm965 video card

    Hi Experts,
    I am keep getting the stop error 0x00000116 failing with a blue screen while im browsing. I have observerd this quite a few times and also I could not find the correct video drivers for my t61 thinkpad in the ibm site. I could see the details as wxp & windows vista but not for win 7. Please find the link below which has all the video drivers fro t61. Please help me find the correct customized video drivers fro my t61 + win 7. Hope you understand my problem.
    By the way i just use for home computing and my win 7 is upto date wiht no extra software and games installed. I dont play games at all on my t61.
    my t61 specificaitons : http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-67883
    If you see the link http://www-307.ibm.com/pc/support/site.wss/document.do?sitestyle=lenovo&lndocid=MIGR-67853
    if u search in the baove link ,you cannot find the video drivers for t61 + win 7. You have it only for xp & vista in this section. Intel X3100 (940GML, 945GM, GL960, GM965). there are no video drivers for win 7 for t61. my video card info is
    Video chipsets:
    Intel PM965/GM965 graphics. (15.4 inch).
    my video card is Intel PM965 chipset . Please help me to get the correct customized version of the video drivers for my thinkpad as I am getting this problem with video drivers and its getting restarted when I am in the middle of something. But it works find after that. I have tried to install drivers from intel and its saying i have customized version of lenovo drivers and I should contact you guys. I triedcomplete  win 7 update from windows site and installed all patches and still getting the problem intermitently, but after restart it works fine. No hardware or software changes. Its that I need the correct version of video drivers for win 7. Please inform the lenovo about this and ask them to develop the good video drivers for win 7 + t61 model. Hope you understand my situation.
    Please let me know if you need any kind of info so that i can provide.
    thanks for reading the mail.
    Regards,
    Manu

    Are you kidding me ? You dont work for Lenovo and you are an active volunteer here in this forums. I have seen your replied many times and wont get paid by Lenovo, you are really crazy for ur stufee .Anyways thanks a lot for the link and the original lenovo staff were notable to provide the link and you could. Well I have tried that what you have said nd still I could not get the link, here you go..
    http://www-307.ibm.com/pc/support/site.wss/product.do?doccategoryind=50880&template=%2Fproductpage%2...
    Let me install the drivers from your link and I will reply soon, so who ever search in this forum now , there wont be any problems for t61 windows 7 video drivers because of u. You are awsome.wll reply my results soon.

  • How to find the exact user exit for our requirement?

    Dear Mr. keerthi,
    can you please explain me how to find the exact user exit for our requirement?

    Hi sandip
    There is more than one method in which you can check for user-exits.The following method is used very often.
    <b>How to find the exact user-exit for your requirement.</b>
    1.     You can check the user exists using transaction SE85.
    2.     Repository Information System -> Enhancements -> Customer exits
    3.     You can search the user-exits by package name.
    4.     Double click on each exit name to check the function module exits.
    <b>The procedure to find the package name.</b>
    Execute transaction SE93 
    Enter the tcode of the transaction for which you want to check the user exit.
    Example: if you want to find the user-exit for purchase orders while changing, enter ME22n  and press display.
    You will get to see the package name
    But you need to confirm that the user exit will get triggered at the appropriate event.
    ( example: you might want some validations to be done ON SAVE of a purchase order)
    <b>Checking if the user-exit is getting triggered or not.</b>
    1.     Open the user exit function module (that you have got in step 4) in Tcode SE37.
    2.     Click on where used button. In the pop up that immediately appears choose only programs .
    3.     You will get a list of programs. Double click on the program name.
    4.     You will get the list of location where this function module user exit is used.
    5.     Place session break points at each of these location ( at each CALL FUNCTION statement)
    6.     Now go to your transaction ( say change purchase order tcode:Me22n) and check if the user exit is getting triggered on appropriate event.
    regards,
    Prasad

  • What are the minimum system requirements for GB 4?

    What are the minimum system requirements for GB 4? I did search this forum but wasn't able to find a direct answer.
    I'm running version 3.0.4 successfully on a lowly G4 733 but I suspect this is as far as I can go.
    I'm updating to iDvd'08 and was also wondering if I can safely update to GB4 or not (from GB 3.0.7) on a G4 733 mhz Digital Audio. Any help would be sincerely appreciated. My guess is that I cannot but I'd like to confirm prior to attempting any further updates in GB.

    I try my best to play it safely; always. And you were right, everything worked on the ext. FW HD flawlessly ...... truly amazing software!
    (I did happen to check the activity Monitor w/in Utilities and it showed GB4 using about 60-67% of the CPU on a G4 733 ..... I'm assuming this is normal).
    Click Here
    Not sure if there's a correct order to opening these apps as there has been in former versions of iLife ..... however, this (as shown above) is the order in which I opened all apps, and all worked well.

  • How do I install OS 10.7 NOT 10.7.5 on a mac running Snow Leopard 6.8  i.e. where can I find the original install app for Lion OS 10.7.0?

    I'm running 10.6.8 Snow Leopard fine on my MacPro1,1, Dual-Core Intel Xeon, 2.66 GHz  Mac, but I need to install Lion 10.7.0 to run a program I need.How do I install OS 10.7 NOT 10.7.5, because I get this message when I try to install 10.7.5, which I've downloaded:"This update requires Mac OS X version 10.7." on a mac running Snow Leopard 10.6.8, So i need to install the original 10.7.0 over the 10.6.8  i.e. where can I find the original install app for Lion OS 10.7.0? The original Lion 10.7. is not avaialable for purchase from the App store or anywhere,  even C-Net . Where can I find it to purchase?
    Also it seems I cannot install Mountain Lion over 10.6.8 as advertised. When I go to purchase I get this message: "We could not complete your purchase. OS X Mountain Lion is not compatible with this computer."   I think my computer can handle it (specs above) Are there any workarounds to this?

    If you're getting a "This update requires Mac OS X version 10.7" message, than you have the updater and not the full installer. Go to your Purchases section of the Mac App Store and you should see the full version there. But it may be 10.7.5, though in my system is shows as being from 2011 which would appear to be the original version.
    As to Mountain Lion, that's supported only on the Early 2008 Mac Pro or newer.
    Regards.

  • In which table can I find the name and surname  for a username ?

    Hello,
    I search the table with the master data of users. Specially I search the table where I can find the
    name, surname for a user.
    In which table can I find the name and surname  for a username ?
    Thanx in Advance

    Hello  everybody,
    thank you for the helpful informations.
    thank you very much
    with kind regards
    cetoman

  • Need to find the dependent object details for an object.

    Hi,
    Is there any query to find the dependent object details for any object. Like if mview is built on a table, then i should be able to find the table name with out checking code of the mview. Thanks in-advance for your support. similar way for view and functions or procedures etc...
    Regards
    DBA.

    Hi all,
    Thanks a lot for your inputs. seems i have not given full details in my post. I need to have a SQL Query to find the dependent object details not DDL.
    if i give a metriealized view name, i should get the base table names directly not DDLs...
    if i give index name i should get its corresponding table name(off course i got this already)...
    if i give a function name, i should get all the tables which are being in the function...etc...
    i am looking for a script which will cover all the aspects.....i hope i have given now enough information for this....
    Regards
    DBA.

  • I am trying to connect a PC wirelessly to my Mac OS X. The PC finds the Mac but asks for the WEP number. Where do I find this number?

    I am trying to connect a PC wirelessly to my Mac OS X. The PC finds the Mac but asks for the WEP number. Where do I find this number?

    Then use multipel 99 picture slideshows. 
    You can have up to 8 or 9 slideshows per menu.  If you add a sub menu reduce that by 1 and add 8 more to the sub menu.  The top menu can have links to up to 8 or so submenus (depends on the theme) and each submenu can have up to 8 or so slideshows. 
    However, converting a very large slideshow to a QT movie as Terence suggested does not envoke the 99 slide limit in iDVD.  It just becomes a single video/movie file.  So you should not have a problem with exporting at the large size, 720 x 540,
    and dragging the resulting file into the iDVD menu being sure to avoid any drop zones.
    OT

  • Does anyone know what the file "memeodhelper is? It's preventing me from backing up my home directory. I can't even find the file with search. Hidden somehow?

    I would like to backup my Mac by copying my home directory to an external disk. When I try this, it always gets hung up on a file called "memeodhelper" saying I don't have permission to access the file and the paste stops. Can't find the file with a search. Any ideas?

    Hi Ray,
    Spotlight is no good for finding anything Apple thinks you don't need to find.
    You can "fix" that error...
    http://www.somewhereville.com/?tag=memeodhelper
    Or likely trash it...
    https://discussions.apple.com/message/11237019?messageID=11237019&tstart=0#11237 019?messageID=11237019&tstart=0
    Find Any File...
    http://apps.tempel.org/FindAnyFile/
    Hold Option or alt key when selecting Find to Find All.
    EasyFind...
    http://www.devon-technologies.com/download/
    Near the bottom of the page.

  • Finding the minimum number greater than zero in an array

    Hi All,
    I have an Array (Attached). I need to find the minimum number that is NOT zero.
    Using the Array Max & Min returns 0 as the min. What I want is the next minimum number.
    Thank you.
    D
    Attachments:
    Array.jpg ‏72 KB

    Do you also need the position of the found element? What if several numbers have the same minimum value?
    If you just want the value of the smallest nonzero element,  here's what I would do. All you neet to do is retain is a single number.
    This assumes that your zeroes are really zero. With DBL you never know.  
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SmallestNEZero.png ‏20 KB

Maybe you are looking for

  • REJECT_CODE Vendor information and/or Operating Unit information is missing

    hi i am using Oracle Applications : 11.5.10.2. i am trying to load suppliers and suppliers data into oracle AP. i tried doing this with some sample data. i executed the following code below : insert into AP_SUPPLIERS_INT (VENDOR_INTERFACE_ID, VENDOR_

  • Assign a space at a file level (not an application)

    I use Parallels desktop all the time and I love being able to assign a full screen Windows VM to Space 2, easily flipping back and forth. I'd like to do this with other VM's - Linux on Space 3 for example. However, it appears I can not assign the VM

  • Who can help me with my ORDER?!

    I had made an online order for my iphone 5s on 11/15 online. It showed that will be delivery by 11/19. I  had recived the email with conformation # as quickly, but it always show "being processed, check it back tomorrow" in my order status. I have ch

  • Optimization problems in downloading data of greater size from any URL.

    Hi everyone ! I'm trying to download some resource from the internet by providing valid URL. My code takes almost 50-55 minutes to download. The same resource is downloaded within 3-5 minutes by using Internet Explorer and 3-4 minutes using Fire Fox

  • How to implement extension for a mara table

    Hi All, Recently we appended mara table with couple of fields. But in order to make use of these two fields in all bapis and other functions how to add these fields to those bapis (i mean how to make extensions). Some where i read that we have to add