Home > Back-end >  Whether a number is an integer c?
Whether a number is an integer c?

Time:10-08

O, teach, I am a novice, is writing a program to do a math problem, now encountered a difficulty,

Interested can look at the topic

CodePudding user response:

This topic and questions irrelevant

CodePudding user response:

reference 1st floor csucxy response:
this topic and questions irrelevant

I wrote the program to solve the problem of the need to decide whether an integer

CodePudding user response:

reference 1st floor csucxy response:
this topic and questions irrelevant

Can you tell me how to distinguish the integer

CodePudding user response:

Title mean to give you a heap of positive integers, find the qualified/is not a square number or not cubic number sequence of the 500th item, you a a prescribing efficiency is very low, it can get a number 1, 2, 1, 1 that you can get two Numbers 2 and 4,8,4 and 8 respectively can get two Numbers, so this series can be found

CodePudding user response:

Know strong turn, you can put a number assigned to an int variable, if the decimal is, to be strong into an integer, and then use this int variables and the variables do contrast, if the equal, this value is an integer, or decimal, don't know what I said is not clear enough?

CodePudding user response:

C no accurate way to judge whether an integer, only by abs ((double) a - (int) a) & lt; 1 e - 9

CodePudding user response:

 # include & lt; Stdio. H> 
# include & lt; String. H>

# define N 500

Int main (void)
{
Int arr={0} [N * 2];
int count=0;
Int I;

For (I=1; I * I & lt; N * 2; I++)
Arr [I * I]=1;

For (I=1; I * I * I & lt; N * 2; I++)
Arr [I * I * I]=1;

For (I=1; I & lt; N * 2; I++)
{
If (arr [I]==0)
{
Count++;
If (count==500)
{
Printf (" % d \ n ", I);
break;
}
}
}

return 0;
}

CodePudding user response:

This question is very interesting

Strong c/c + + is a syntax checking, you define variables to know its data type, don't need to do inspection
  • Related