Best Two in Three Numbers

Hi i had written a logic for finding out two best nos out of three.
But i think i m using BAD logic,
any good guess than this??
int a, b, c, max1, max2;
a = 10;
b = 20;
c = 30;
max1 = a > b ? (a > c ? a : b) : (b > c ? b : c);
if(max1 == a )
   max2 = b > c ? b : c;
else if(max1 == b )
   max2 = a > c ? a : c;
else if(max1 == a )
   max2 = a > b ? a : b;
System.out.println("Max1 = " + max1 + "  MAx2 = " + max2);Can there be any other logic than this??
--Bhupendra Mahajan

Assuming that max1 and max2 don't need ordering, it is sufficient to reject the least:if (a>=b) {
  max1 = a;
  max2 = b > c ? b : c;
} else {
  max1 = b;
  max2 = a > c ? a : c;
}Pete

Similar Messages

  • Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?

    Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?

    Remove the extensions, redownload Safari, reload the extensions.
    http://www.apple.com/safari/download/
    And if you really want a better experience, use Firefox, tons more choices and possibilities there.
    Firefox's "NoScript" will block the Trojan going around on websites. Best web security you can get.
    https://addons.mozilla.org/en-US/firefox/addon/noscript/
    Ghostery, Ad Block Plus and thousands of add-ons more have originated on Firefox.

  • I'm tring to install two Daqcard700​'s in same computer running Win2000 and Nidaq6.9.2 and the cards are not given two different device numbers by the NIDAQ device configurat​ion wizard.

    One Daqcard 700 and one daqcard 16x-50e in same machine work fine but two Daqcard 700's are not assigned two diferrent device numbers by the device configuration wizard.

    I have this same problem with the previously described observations.  I tried two Daqcard-700s in three different laptops, two with Windows XP and One with Windows 2000.  Tried all suggestions in Knowledgebase and Forum I could find with no luck.  Single cards work ok.  Removed and reinstalled drivers in Device Manager.  Tried the Windows 2000 patch for this problem.  Changed the PCMCIA adapters on the laptop to Generic Cardbus  Controller from one suggestion.  Running Labview 6.1 with Ni-Daq 6.9.3 and Max 3.1. Tried also Max 2.1.
    Any help will be greatly appreciated.
    thanks,
    Ben1167

  • HT4362 Screensaver shows the same photographs every two or three minutes  while I have 1600 pictures to select.

    With Apple TV Screensaver ............ I have 320 pictures from which to select:  Why do I get the same pictures every two or three minutes?  Either very poor software engineering my Apple or arrogance by Apple TV.  I set time delay for 10 minutes to allow all pictures to load before setting actual time delay at 2 minutes.  The feature is worthless with this format,

    That is probably correct...
    If you are trying to extend them in the same direction, this will not work....
    See this Apple doc:
    http://support.apple.com/kb/HT4259
    Also see this:
    Wirelessly Extended Network (802.11n)
    If you are unable to build the recommended Roaming network, then a Wirelessly Extended Network is the next best option.
    To create a Wireless Extended Network you must place the extended Wi-Fi base station within range of the primary Wi-Fi base station.
    Extended network range considerations
    In the above example the primary Wi-Fi base station ➊ is out of wireless range of the extended Wi-Fi base station ➋, therefore the extended Wi-Fi base station cannot join or extend the wireless network. The extended Wi-Fi base station must be moved to a location that is within Wi-Fi range of the primary Wi-Fi base station.
    Important Note
    If another extended Wi-Fi base station ➋ is placed between the primary Wi-Fi base station ➊ and the extended Wi-Fi base station ➌, the extended Wi-Fi base station ➌ will not allow clients to join it. All extended Wi-Fi base stations must be in direct range of the primary Wi-Fi base station
    Please read the last Important Note above...........

  • 15" i7 Macbook Pro from early 2011.takes the mac laptop two or three tries to boot successfully. It would turn on, show gray screen, shut down, turn on again, show gray screen, shutdown, and then turn on, show gray screen, before it can finally get

    Hello All,
    I have a 15" i7 Macbook Pro from early 2011. The past few weeks, it has been getting increasingly difficult to get on my computer. It takes the mac laptop two or three tries to boot successfully. It would turn on, show gray screen, shut down, turn on again, show gray screen, shutdown, and then turn on, show gray screen, before it can finally get to the dark gray log-in screen. Even when I finally get logged in to start working, thinking it would be okay now, it shuts down randomly.
    I've ruled out the possibility of a software problem because I've just done a clean re-install of Mac OS X Mavericks on my computer just yesterday.
    I did upgrade the RAM recently, about a month and a half ago, from 4GB to 16GB, I went to the apple store four days after that upgrade to have them do a hardware test, and clean the inside of my laptop, which helped with previous heat issues. When they did the hardware test, the hardware was all registered as fine from their system.
    I've tried resetting the SMC, PRAM, and doing the internet recovery hardware test, but to no avail. I thought I could at least find out what parts needed to be replaced from the hardware test but it seems that when the hardware test is almost finished, the computer just shuts down, So I am unable to see the results.
    My computer is also having battery issues, under battery condition, it says "replace now," parts have been ordered, waiting for arrival. But if the battery health is low, it should still boot up fine, it would just hold a significantly less charge.
    Could this be a hard drive issue?
    Has anyone had similar symptoms and how was it resolved?
    Does anyone know what I can do to alleviate this issue?
    I haven't had time to take it to Apple because I'm currently taking a 21 credit semester academically. I'm an art and design student so my computer is basically the bane of my existence. Help! Any constructive advice is welcomed!
    Thank you so much for your input!
    -Christina C.

    Problem description:
    The Hard Disk is failing.
    EtreCheck version: 2.0.11 (98)
    Report generated November 4, 2014 at 7:59:28 AM EST
    Hardware Information: ℹ️
      MacBook Pro (15-inch, Early 2011) (Verified)
      MacBook Pro - model: MacBookPro8,2
      1 2.2 GHz Intel Core i7 CPU: 4-core
      16 GB RAM Upgradeable
      BANK 0/DIMM0
      8 GB DDR3 1600 MHz ok
      BANK 1/DIMM0
      8 GB DDR3 1600 MHz ok
      Bluetooth: Old - Handoff/Airdrop2 not supported
      Wireless:  en1: 802.11 a/b/g/n
    Video Information: ℹ️
      Intel HD Graphics 3000 - VRAM: 512 MB
      Color LCD 1440 x 900
      AMD Radeon HD 6750M - VRAM: 1024 MB
    System Software: ℹ️
      OS X 10.9.5 (13F34) - Uptime: 0:3:43
    Disk Information: ℹ️
      TOSHIBA MK7559GSXF disk0 : (750.16 GB)
      S.M.A.R.T. Status: Verified
      EFI (disk0s1) <not mounted> : 210 MB
      HDV4 (disk0s2) /  [Startup]: 749.30 GB (712.10 GB free)
      Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
      MATSHITADVD-R   UJ-898 
    USB Information: ℹ️
      Apple Inc. FaceTime HD Camera (Built-in)
      Apple Inc. BRCM2070 Hub
      Apple Inc. Bluetooth USB Host Controller
      Apple Inc. Apple Internal Keyboard / Trackpad
      Apple Computer, Inc. IR Receiver
    Thunderbolt Information: ℹ️
      Apple Inc. thunderbolt_bus
    Gatekeeper: ℹ️
      Mac App Store and identified developers
    Kernel Extensions: ℹ️
      /Library/Application Support/Avast/components/fileshield/unsigned
      [loaded] com.avast.AvastFileShield (2.1.0 - SDK 10.9) Support
      /Library/Application Support/Avast/components/proxy/unsigned
      [loaded] com.avast.PacketForwarder (1.4 - SDK 10.9) Support
    Launch Agents: ℹ️
      [not loaded] com.adobe.AAM.Updater-1.0.plist Support
      [loaded] com.avast.userinit.plist Support
    Launch Daemons: ℹ️
      [invalid?] com.adobe.SwitchBoard.plist Support
      [loaded] com.avast.init.plist Support
      [loaded] com.avast.uninstall.plist Support
      [loaded] com.avast.update.plist Support
      [invalid?] com.perion.searchprotectd.plist Support
    User Launch Agents: ℹ️
      [invalid?] com.avast.home.userinit.plist Support
      [loaded] com.google.keystone.agent.plist Support
      [invalid?] com.jdibackup.ZipCloud.autostart.plist Support
    User Login Items: ℹ️
      None
    Internet Plug-ins: ℹ️
      AdobePDFViewer: Version: 10.1.1 Support
      QuickTime Plugin: Version: 7.7.3
      JavaAppletPlugin: Version: 14.9.0 - SDK 10.7 Check version
      Default Browser: Version: 537 - SDK 10.9
    User Internet Plug-ins: ℹ️
      TroviNPAPIPlugin: Version: 1.0 - SDK 10.9 Support
      Google Earth Web Plug-in: Version: Unknown
    Safari Extensions: ℹ️
      Avast Online Security
      Trovi Search for Safari
    3rd Party Preference Panes: ℹ️
      None
    Time Machine: ℹ️
      Time Machine not configured!
    Top Processes by CPU: ℹ️
          16% mds
          7% WindowServer
          1% loginwindow
          1% fontd
          1% com.avast.daemon
    Top Processes by Memory: ℹ️
      120 MB com.avast.daemon
      86 MB Google Chrome
      52 MB Finder
      52 MB WindowServer
      41 MB Google Chrome Helper
    Virtual Memory Information: ℹ️
      13.45 GB Free RAM
      1.34 GB Active RAM
      944 MB Inactive RAM
      1.43 GB Wired RAM
      1.11 GB Page-ins
      0 B Page-outs

  • Hello, My iCal don't synchronize older events than two or three month ago. How can I do to synchronize all my schedule? In iTunes it's all right in Calendars. I don't put a cross in "synchronize event older than ....... days". Thanks for answer.

    Hello, My iCal don't synchronize older events than two or three month ago. How can I do to synchronize all my schedule? In iTunes it's all right in Calendars. I don't put a cross in "synchronize event older than ....... days". Thanks for answer.

    Just saw your post. Better late than never. You may want to
    consider GameBrix.com, where you can create Flash based, casual
    games using your web browser. No downloads are required. You can
    create a game from scratch using a library of images, sounds and
    game mechanics. You can also upload your own. The online script
    editor will allow you to view and edit the ActionScripts associated
    with each game mechanic. In short, a great way to ramp up on game
    design and build your own game without investing a lot of $
    upfront.
    BTW I am associated with GameBrix so any feedback is
    appreciated.

  • Need help returning largest of three numbers....

    Hello,
    I'm stuck in an essential part of a program. The objective of the program is suppose to call a static method that will find and return the largest of three numbers. Im suppose to test the program with the following three sets of three numbers: (2, 5, 8), (2, 10, 5), (67, 23, 17).
    After lots of thinking, I decided to write a program that will do exactly what the objective requires, but without calling a static method that will find and return. I tried calling a static method but it's real confusing and I couldnt do it right.
    Below is my program, the top part is right I think, but calling a static method and returning the value is the part Im having trouble in.
    // The "LargeNum3" class.
    import java.awt.*;
    import hsa.Console;
    public class LargeNum3
        static Console c;           // The output console
        public static void main (String [] args)
            c = new Console ();
            int num [] = new int [3];
            int largest;
            largest = num [0];
            for (int i = 0 ; i < 3 ; i++)
                c.println ("Please enter in 3 values");
                for (int a = 0 ; a < 3 ; a++)
                    num [a] = c.readInt ();
                for (int b = 0 ; b < num.length ; b++)
                    if (num > largest)
    largest = num [b];
    c.println ();
    c.println ("The largest number is " + largest);
    c.println ();
    } // LargeNum3 class

    // The "LargeNum3" class.
    import java.awt.*;
    import hsa.Console;
    public class LargeNum3
        static Console c;           // The output console
        // Declare a new static method to return the
        // largest number in the array passed to it
        public static int findLargest(int[] nums)
            int j, largest=nums[0];
            for (j=1; j<nums.length; j++)
                if (nums[j]>largest) largest=nums[j];
            return largest;
        public static void main (String [] args)
            c = new Console ();
            int num [] = new int [3];
            // int largest;
            // largest = num [0]; It was wrong to put this here in
            // in the first place
            for (int i = 0 ; i < 3 ; i++)
                c.println ("Please enter in 3 values");
                for (int a = 0 ; a < 3 ; a++)
                    num [a] = c.readInt ();
                c.println ();
                c.println ("The largest number is " + findLargest(num));
                c.println ();
    } // LargeNum3 class

  • How to add two different page numbers in a single page

    How to add two different page numbers in a single page? One is for page number of the whole article, the other one is for page number for each chapter in the article.

    It's quite complicated, see
    Two Page Numbering Schemes in the Same Document.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • After uploading our phones with the latest update, we have noticed that the battery life has deminished considerably.  I now have to charge my phone overnight and two or three times a day. Prior to the update, my battery life lasted me at least a full day

    After uploading our phones with the latest update, we have noticed that the battery life has deminished considerably.  I now have to charge my phone overnight and two or three times a day. Prior to the update, my battery life lasted me at least a full day.  We have several phones in our office and the ones that have updated (4) now have issue holding a charge/battery life. I really liked this phone and can not believe that you are now going to charge us $79 a battery to fix what is most definately a problem with your latest update.  I know other people outside of our company that are having the same problem. Not to mention when I called AT&T it was confirmed to me that they are hearing the same issue and then some from other customers as well.  Your own people, once I talked to them earlier today, told me they are showing a history of issues that are showing up after the update was put in place. Of course she tried to say, "Maybe the age of the battery and the update both contributed".  Whatever. 
    I want you all to know how disappointed I am in your company for the handling of this issue.  I always thought "Apple" was the line I didn't have to worry about having any types of issue. And that you all would stand behined your product 100%. Now I am not so sure.   
    I would love to hear back from your company on how you perceive the issue with all of these phones that prior to the update didn't have any issues and how after the update THEY ARE NOW having issues.  I do not believe this was an issue due to the age of a battery and that was pretty lame to say so.  It was fine and now its not.
    Please feel free to contact me and help me figure out a way to pay for all of the batteries that will be needed for our company to contiue doing business as needed.
    Thank you.
    Web Address (URL):
    5106 McNarney

    Sorry this is a user to user technical forum.  There is NO APPLE here as stated in the term of use when you signed up for this forum.
    here are some battery tips
    http://osxdaily.com/2013/09/19/ios-7-battery-life-fix/
    http://www.apple.com/batteries/iphone.html

  • I have two different 5s's with two different phone numbers but they are both using the same iCloud/apple account. After upgrading to iOS8 when I get a phone call on one phone both phones ring.

    I have two different 5s's with two different phone numbers but they are both using the same iCloud/apple account. After upgrading to iOS8 when I get a phone call on one phone both phones ring. One phone is for work and one is for private and I don't need both phones to ring from one call. It's bizarre.......is this supposed to be like this? If so where can I turn it off?? And while we are at it iOS8 has installed iBooks on both of my phones and iTunes won't let me uninstall it. I don't need or want iBooks on my phones.

    Hi,
    There are two easy fixes to this.
    One, you can set up Family Sharing, in which you can have two different iCloud Accounts, yet still share the same apps, music, media etc.
    Two, go to Settings and turn-off "Handoff". This can be found under the General page.
    Hope this helps!

  • How do I set up a two or three column schedule in iCal? Looking to have multiple person listing appointment times.

    How do I set up a two or three column schedule in iCal? Looking to have multiple person listing appointment times.

    How do I set up a two or three column schedule in iCal? Looking to have multiple person listing appointment times.

  • Why do I have to pay for a charge that I should not of been charged then wait for the credit in two to three billing cycles? If I don't pay it I get charged $5 a month late charge?

    So I spent a considerable amount of time on the phone with Verizon about charges on my wireless bill. The conclusion of it was: Pay the charge and we will credit the charge or it will show as a balance due with a $5.00 late fee every month. I got two phones on a promotion in November. Part of the promotion was no activation fee. Got my first bill and a $70.00 activation fee was on it. On line chatted with Verizon and they said it would be credited in two to three billing cycles. I paid my bill minus the activation fee. This month I have a $5.00 late fee and a $35.00 restocking fee because they messed up and sent three phones and I returned one. It was not activated. They might credit me that money back. What is going on?????

        I am so very sorry for any aggravation you've experienced getting your billing straightened out, Nunu1957. It's true that it can take 1 to 2 billing cycles for some account balance adjustments to appear on a statement. While I know you'd rather not have paid your activation fees, the terms of your agreement do require you to do so in order to avoid late fees or even involuntary service interruptions.
    I am concerns about the restock fee. If the device was sent to you in error, you should not have been billed a restock fee. You stated that there may be a refund for the fee. Has that been confirmed?
    DionM_VZW
    Follow us on Twitter www.twitter.com/vzwsupport

  • DBMS_DATAPUMP How to ignore two or three tables

    Hi,
    I have to export complete schema using DBMS_DATAPUMP . 
    What is the syntax    to ignore  two or three tables from this schema .

    your above code not woking
         dbms_datapump.metadata_filter
         (handle=>handle
         ,name=>'NAME_EXPR'
         ,value=>' NOT IN (SELECT TABLE_NAME FROM DBA_TABLES WHERE TABLE_NAME LIKE ''YOU%'')'
    it shows the following error message
    Error report:
    ORA-39001: invalid argument value
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 3444
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 3693
    ORA-06512: at line 20
    39001. 00000 -  "invalid argument value"
    but following  codes working fine
      Dbms_Datapump.Metadata_Filter(handle => h1,name => 'NAME_EXPR',value => '!=''SU_HANDSET_HISTORY''',
        object_type => 'TABLE');

  • I have totally "uninstalled" what I had and then reinstalled the newest  version of itunes.  Still......  First, when I click on the itunes icon to load it takes the program anywhere  from two to three minutes to load.  None of my other programs take this

    I have totally "uninstalled" what I had and then reinstalled the newest
    version of itunes.  Still......
    First, when I click on the itunes icon to load it takes the program anywhere
    from two to three minutes to load.  None of my other programs take this
    long.
    When in the itunes program I can be moving around in my library and itunes
    when choosing a song or songs, choosing file, edit, etc,. whatever command I
    choose it just suddenly stops.  I can issue five commands and watch each one
    respond in 30 second to two minute intervals.  I can issue several commands,
    even shutting down, and it will do all but takes several minutes to do so.
    My itunes program was working fine when this problem suddenly arose.
    Terry

    Click here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components, or run the process multiple times; this won't normally affect its library, but that should be backed up anyway.
    (99436)

  • How do I get all two or three hours of a podcast ?

    With the new itunes 11.0.1 I can only get the first hour of a two and sometimes three hour podcasts? How do I get all two or three hours?

    Easiest way is to click on the foreground colour which opens the Color Picker dialog box, and changes the cursor to the eye dropper.  Now click on the colour.  If it is crucial that it uses your selected area, copy the selection to a new layer.   I have no idea if you want a point sample, or average of entire selection or what though?

Maybe you are looking for

  • I can't see AP on WLC

    Hi, I'm trying to find out why my APs can't join to WLC. Both are in the same Vlan, AP has a static IP (the same subnet). Thanks for any advice (Cisco Controller) >*spamApTask1: Oct 24 21:13:25.715: 4c:4e:35:c7:0f:ab CAPWAP Control Msg Received from

  • Madwifi won't compile.. .grrr (solved)

    I tried to compile madwifi from multiple sources (from the source I had to the pkgbuilds I downloaded), and they all yield the same error at the same time, which leads me it has something to do with a kernel  config or something...  It compiles norma

  • Help! Painfully slow broadband!

    Hi All! I'm in need of some help discovering why my internet has gone so slow it'd be faster back on dial up! I generally until Monday (29th) had speeds around 3Mbps but since then after doing speed tests I only appear to be getting around 0.5Mbps. C

  • How to set

    I am running a prgram from command line which requires to pass command line argument with -D option to set several directories in the JVM for java extension mechanism. I could successfully run my program as below by using a variable. set EXT_DIRS = "

  • How do i iterate through this html document.

    I trying to read in an html file which looks like this <ID>1</ID> <BODY>blah bal blah blah bal blah. </BODY> <ID>5</ID> <BODY>blah bal blah blah bal blah. </BODY> <ID>7</ID> <BODY>blah bal blah blah bal blah. </BODY> Problem is i need to record the i