Thread: problem with if()

  1. #1
    Registered User
    Join Date
    Nov 2010

    problem with if()

    my code here work fine. but it seem a bit long for me. what the best way to find the biggest or smallest number if the numbers is more than 10 number?please help me. appreciate for all reply. thanks . here is the code :
    	int a,b,c,d;
    printf("Input four numbers to get the biggest number:\n");
    printf("the biggest number is %d",a);
    printf("the biggest number is %d",b);
    printf("the biggest number is %d",c);
    printf("the biggest number is %d",d);

  2. #2
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Cambridge, UK
    Well the eastest way is to sort the array if had 10 elements and print the largest either a[0] or a[n]. Simple as that . Have a look on qsort() function

    Last edited by ssharish2005; 11-23-2010 at 07:49 AM.
    Life is like riding a bicycle. To keep your balance you must keep moving - Einstein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM