Je ne vois pas de difficulté particulière sinon le tri.
// un exemple de tri à bulles
int trier_tab_croissant(int tailletab, int* tab)
{
int pos = 0;
int tempval;
int somme = 0;
while( pos < tailletab-1 )
{
if( tab[pos] > tab[pos+1] )
{
tempval = tab[pos+1];
tab[pos+1] = tab[pos];
tab[pos] = tempval;
pos = -1;
}
pos++;
}
for(pos=0; pos<tailletab; pos++)
somme += tab[pos];
return somme;
}
void main()
{
const int SIZE = 3;
int unTab[SIZE] = {10, 50, 40};
int sum = trier_tab_croissant(SIZE, unTab);
for(int i=0; i<SIZE; i++)
{
printf("%d", unTab[i]);
if( i==SIZE-1 )
printf(" = %d", sum);
else
printf(" + ");
}
}
Ce code n'est pas testé !!! Mais je pense que ça doit marcher.