answersLogoWhite

0

How check four number in c who is bigger?

Updated: 8/20/2019
User Avatar

Ukfbg1983

Lvl 1
12y ago

Best Answer

In order to determine which of four number is bigger you need 16 if statements arranged in a nested if statement. That exceeds the complexity of just sorting it in an array. Here is a solution using a simple array sort.

int array[] = {7, 2, 27, 4};

int i, swap;

do {

swap = 0;

for (i = 0; i < 4; ++i) {

if (array[i]<array[i+1]) {

swap=array[i];

array[i]=array[i+1];

array[i+1]=swap;

swap=1;

}

}

} while (swap == 1);

printf ("%d\n", array[0]);

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How check four number in c who is bigger?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the composite number bigger than C?

C+1 if C is not composite, and C+2 if C is a composite.


How do you check account holder's name using account number?

how to know a/c holder name by a/c number


If a is bigger than b and b bigger than c which statement must be true?

if a is bigger than b and b is bigger than c a must be bigger than c... Transitivity


How do you check subtraction?

If any number B is subtracted from a number A to give C, then C+B =A If A - B = C then B+C = A Eg 7 - 2 = 5 Hence 2 + 5 = 7


How many amps in four C batteries in series?

C batteries use 1.5 volts. The number of amps depends on what device it is hooked up to. An average for four C batteries would be about 16 amps.


Are six cups and C pints equal or is six cups bigger and C pints are smaller or C pints are bigger and six cups are smaller?

6 cups are bigger


Is the airbus a380 bigger than the C-5 Galaxy?

The A380 is bigger but the C-5 is longer


Where is the serial number on a 12 gauge L C Smith shotgun?

Check the receiver


Is d or c bigger in bra size?

D is bigger


If four more children chose green write a number sentence that tells how many children like green now?

If four more children chose green, a number sentence that tells how many children like green now is: 4+c= _ c= number of children


What are facts on the viola?

They have four strings. From highest to lowest A D G C which is the same as a cello but higher. They are slightly bigger than violins. Viola music is mainly written in the alto or C clef.


Which one is bigger 10 degree C OR 23 degree F?

23 is a bigger number than 10.If you want to talk about temperature, there's really no such thing as'bigger' or 'smaller' temperatures.10&Atilde;&sbquo;&Acirc;&deg;C is a 'warmer' temperature, or a 'higher'temperature, than 23&Atilde;&sbquo;&Acirc;&deg;F.But please, not a 'bigger' one.