I am not sure to understand you correctly but a way to find the max and the difference between max and all numbers would be...
Create a variable "max" and assign zero
do a loop to determine the highest value
evaluate if actual number is bigger than max
if yes: assign the actual value to max
if not: check the next number
Optional: you can save the position of the max as well if you want/need to
Once you have the max value you make another loop
you get the diference of each position just substracting both values
(if you want it without sign, then use the absolute value)
the difference can be saved in another set or array or whatever you need
If this is not what you are looking for... then please use the "improve question" right side below your message and explain it better.
Addition: Doing it on the easy way.
int max = 0;
int i;
for (i = 0; i < original_set_length; i++)
{
if (original_set[i] > max)
{
max = original_set[i];
}
}
for (i = 0; i < original_set_length; i++)
{
differences_set[i] = max - original_set[i];
}