I'm making a program to find the perimeter of any shape, and it's separated into two sections: polygons, and non-polygons. My polygon section works interestingly, in which it asks the user for the number of sides and then let's you input numbers until the number of entries reaches the number of sides. I have a feature implemented that makes sure one enters a number 3 or greater (because polygons have to have 3 or more sides) but is there a way to make sure one enters a whole number (because you can't have a polygon with 2.8, 4.87, etc. sides)?
Sure, just check if the number rounded down is the same as the number, i.e.
If A=int(A)
Another trick is to check if the decimal part is equal to 0, like this:
If not(fPart(A

Also, welcome to Cemetech! Smile
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum