Re: Need help with a method for converting a double to an int in C# !
Originally Posted by
Egonosaur
I wonder what the algorithm would be to convert the floating point number 0.73 to integer 73.
I want to make a method to do the operation, for example if I call my method Program.ToPercentage(0,73) the console will print just 73.
Is it possible to start the method with:
static int ToPercentage(double floatingpointnmbr)
I'm very new to programming and I'm learning how to make methods in C# at the moment.
I appreciate any help I can get!
What should be the output of Program.ToPercentage(0.731)? Should it print 731, 73, or the non integer number 73.1? The name of the function would suggest that what you need is to multiply the number by 100.
- What do you get if you multiply six by nine?
- 42!
Bookmarks