-
#include ""
void main()
unsigned char num[10];
unsigned char i,j,temp;
for(i = 0;i < 10;i++)scanf("%d",&num[i]);
for(i = 1;i < 10;i++)if((num[0] >num[i])|num[0] == 0))temp = num[0];
num[0] = num[i];
num[i] = temp;
if(num[0] == 0)
printf("Enter at least one number greater than 0");
return;
for(i = 1;i < 9;i++)
for(j = i+1;j < 10;j++)if(num[i] >num[j])
temp = num[i];
num[i] = num[j];
num[j] = temp;
for(i = 0;i < 10;i++)printf("%d ",num[i]);
First of all, determine the number that is not 0 in the first place, and then sort the next 1 to 9 digits according to the size of the number.
-
#include
define max size 100 I wrote casually, I need to change it myself.
void get_array(int *array,int size)
printf("Please enter:");
for(int i=0;iscanf("%d",&array[i]);
int min_index(int *array,int size)
int min=array[0];
for(int i=1;iif(array[i]min=array[i];
return min;
int main()
int array[max_size], size, index;
scanf("%d", &size);
get_array(array, size);The function has been given above.
index = min_index(array, size);It is not necessary to declare it before the main function.
printf("minimum number is %d, whose position is %d.", array[index], index);
return 0;
-
The main idea: cycle through the combination of five digits to match x; Then find m nvoid comp (int x,int min, int max)}if((base 1[i]*10000+base[j]*1000+base[k]*100+base[l]*10+base[m])<=max)}}
cout<<"count = "
#include
using namespace std;
Calculate the sum of the numbers.
int sums(int x)
return sum;
int main()
cout<<"Minimum:"<
Related questions7 answers2024-04-10Look"Malloc", there is an article on the first page that is clearly written.
Singly linked list questions are written in C, c Linked list class template questions Don't use C, u3 answers2024-04-10Heada and headb are both singly linked lists with leading nodes. In this algorithm, we delete the common elements from the ith element in the heada linked list, and then insert the single-linked list heada before the jth element of the headb. >>>More
6 answers2024-04-10I majored in computer science, and I was embarrassed when I first learned C language, but I also had some experience. >>>More
11 answers2024-04-10srand(int) is used to set the seed, and then returns a random value each time rand(). >>>More
8 answers2024-04-10Method steps.
Open VS2012 - File - New - Project. >>>More