Hi,
how could i check is a number an int or a float?
radiat
0
Newbie Poster
Recommended Answers
Jump to PostSince you created it, shouldn't you already know?
int x; // this one is an int float y; // this one is a float
Jump to PostIn your case you can have a boolean which is equal to false if integer and to true if float. But cant you have only 1 function for division? Why do you need two?
Jump to Postanswer = x/y;
That's going to return an integer anyway - int/int gives an int, no matter what the values are.
Anyway, you already decided on a way, remember?if ((x % y) == 0 ) //if the numbers divide evenly the answer is …
All 10 Replies
Moschops
683
Practically a Master Poster
Featured Poster
radiat
0
Newbie Poster
The_Purple_Mask
0
Newbie Poster
Moschops
683
Practically a Master Poster
Featured Poster
radiat
0
Newbie Poster
Moschops
683
Practically a Master Poster
Featured Poster
radiat
0
Newbie Poster
Moschops
683
Practically a Master Poster
Featured Poster
radiat
0
Newbie Poster
dragon8001
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.