First of all I am a beginner in C#, I have just started to play around with it as that's what my University course requires.
My problem is an assignment question which says:
h) To test if a number entered has an integer value. Hint: The number will have to be of type Double. If, for example, the number is 2.5 that doesn’t have an integer value but 2 does. You will need to use Convert.ToInt32(TheNumber) to convert the Double to an Int then compare the two.
double a, b, result;
Console.WriteLine("Input a number");
a = Convert.ToDouble(Console.ReadLine());
b = Convert.ToInt32(a);
This is what I have at the moment and I don't know how to compare these 2 to test which one is an integer. I am pretty sure that you have to use an if statement but how to tell C# to test which of these 2 numbers is an integer and which one isn't!
Any help is highly appreciated :)