answersLogoWhite

0


Best Answer

First take a array that contain all numbers then sort it.

Now take a variable i = 0 and j = n-1 where n = size of array.

increment i and decrement j till i < j.

Now check that if i == j then a[i] is the median

else{

increment j by one and decrement i by one.

now median = (a[i] + a[j]) >> 1 //here right shifting an integer is same as deviding an integer by 2.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write c program to find median of two numbers without using division?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the median of a set of numbers that add to 1425?

You cannot get a median without the list of actual numbers, so that question cannot be answered.


What is the median if you have ten numbers?

6 is the median of 10 numbers


How do you program an ungrouped median?

find median of n observation in c program


How can you find the median of the data without listing the values?

The median of a data set is the number that is literally in the middle. For example: The median of the number set 1,1,3,4,7, is 3 because it is in the physical middle of the set of numbers. Note: To find a median, the numbers MUST be in written in order the median of 2,6,3, is not 6. You must rearrange them like: 2,3,6 and we can see 3 is the median


What happens when the median has two numbers?

When the median has two numbers, you add the two together and divide by 2 . The median doesn't really have 'two numbers'; you are talking about finding the median of a set of numbers that contains an even number of numbers. The median is half-way between the two.


What is the median of 25343123222628 and 35?

The median of 2 numbers is the same as their mean.So, median = (25343123222628 + 35)/2 = 12,671,561,611,331.5The median of 2 numbers is the same as their mean.So, median = (25343123222628 + 35)/2 = 12,671,561,611,331.5The median of 2 numbers is the same as their mean.So, median = (25343123222628 + 35)/2 = 12,671,561,611,331.5The median of 2 numbers is the same as their mean.So, median = (25343123222628 + 35)/2 = 12,671,561,611,331.5


What is the median of these numbers 274394?

The median is 4


How do I calculate the median in a set of numbers?

Put the numbers in order. The odd one in the middle is the median: 1,2,3,4,5,6,7 (4 is the median). If even numbers, it is between the two middle numbers: 1,2,3,4,5,6,7,8 (between 4 and 5 is the median).


What is the median of these numbers 31 30.5 29.2?

When numbers are put in order either least to greatest or greatest to least, the one in the middle is the median. In an even set of numbers the average of the middle two numbers is the median. 30.5 is the median of these 3 numbers.


What is the median of four numbers?

Arrange the numbers from smallest to greatest. The mean of the middle two numbers is the median.


How does the mean compare to the median?

The mean and the median are both involved with a set of numbers. The mean refers to the average of the numbers. The median refers to the middle number of the numbers


What if you get point like 6.5 in median?

Then that is the median. A median does not have to be a whole number. It can be a decimal number, even when the set of the numbers you are getting the median for are all whole numbers.