#include <stdio.h>
#include <stdlib.h>
void Main () {
13,21,5,37,8,47,6,89,100,37,5 to number of orders
int l_array[] = {13,21,5,37,8,47,6,89,100,37,5};
int l_length = sizeof (L_array)/sizeof (int);
int l_temp;
for (size_t i = 0; i < l_length-1; i++)
{
for (size_t II = i + 1; ii <= l_length-1; ii++)
{
if (L_array[i] < L_array[ii]) {
L_temp = L_array[ii];
L_ARRAY[II] = L_array[i];
L_array[i] = l_temp;
}
}
}
System ("pause");
}//to Number
#include <stdio.h>
#include <stdlib.h>
void Main () {
Now there are 100 yuan, Rooster 5 yuan/Only, hen 3 yuan/only, chicken 1 Yuan 3 only.
Three kinds of chickens must be bought, and just 100 yuan spent, three kinds of chickens added up to fill 100
int x, y, Z;
for (size_t x = 1; x < + × x + +) {
for (size_t y = 1; y < y++) {
z = 100-x-y;
if (z% 3 = = 0 && ((5 * x) + (3 * y) + (z% 3)) = = 100) {
printf ("Rooster%d hen%d chick%d\n", x, Y, z);
}
}
}
System ("pause");
}
021. Two small algorithms