By Anshika Negi
This packet is made to check if the integer entered by the user is a positive integer which means it must not contain a negative value and must not have any characters.
This packet is made to check if the integer entered by the user is a positive integer which means it must not contain a negative value, must not have any characters, and must not be any empty value.
For example, if we enter negative numbers it might create problems with our code so we will keep a condition to check if the number is 0 or less than 0.
Another restriction is to check if the number entered contains any characters or not. Suppose we want to enter the price but by mistake, we entered character as well which will create a problem for us. So we used a function gcount which counts the availability of characters in a given datatype. If it is more than one then it will give an error.
Submitted by Anshika Negi (anshikaaa)
Download packets of source code on Coders Packet
Comments