Current location - Training Enrollment Network - Mathematics courses - Mathematicians and programming
Mathematicians and programming
C language pursues the efficiency of program execution time. After the topic is given to the cube, it has four digits, and the age range can be artificially determined as 10-2 1 year. As for why six figures are not more accurate, I personally think it is unnecessary. The core of this programming is how to distinguish the numbers 10. I defined a function, which is judged by arrays and loops. The following is the specific code.

# Contains? & ltstdio.h & gt

# include & ltstdlib.h & gt

# include & ltmath.h & gt

int? Same (int? a[ 10]); //Judge whether the number of 10 is equal, and if not, return 1.

int? More (int? a); //Determine how many bits an integer has.

Master ()

{?

int? a[ 10]? , me? ,j? ,s? ,l; //a stores an array of 10 numbers, where I is an age cycle variable, J stores the numbers in the array, S stores four digits, and L stores six digits.

for(I = 10; I & lt22; i++){

s=pow((double)i,3);

l=pow((double)i,4);

If (more (l)! =6)

Continue; //If it is not six digits, exit the current loop.

for(j = 0; j & lt4; j++){

a[j]= s % 10;

s = s/ 10;

}//Store four digits.

for(j = 4; j & lt 10; j++){

a[j]= l % 10;

l = l/ 10;

}//deposit six figures

If (same as (a))

printf("age=%d\n ",I); //output

}

System ("suspended");

}

int? More (int? a){

int? I = 0;

while(a & gt; 0){

a = a/ 10;

i++;

}

Return? Me;

}

int? Same (int? a[ 10]){

int? I,j,flag = 1;

for(I = 0; I< 10; i++){

for(j = I+ 1; j & lt 10; j++){

if(a[i]==a[j])

flag = 0;

}

}

Return? Flag;

}