Hey guys..what can i do if i want my program to take 8 digit input number ,no less no more than it.. i try to ask my frind but its hard to get..
(but not using getche()8x)
so example i have to input number ID..and if i input just 2 digit or more than 8 digit it shouldn't response or said that the input is not valid..
@soranz.. you made lots of mistake. n>99999999 it's eight times nine..it should be seven times.. n<10000000 it's one followed by 7 zeros.. it should be 8 zeros.
and you used || between two condition that will accept all input greater that eight times nine(as you write but actual one should have to seven times nine)..
HiteshhVaghani1:
@soranz.. you made lots of mistake.
n>99999999 it's eight times nine..it should be seven times..
n<10000000 it's one followed by 7 zeros.. it should be 8 zeros.
and you used || between two condition that will accept all input greater that eight times nine(as you write but actual one should have to seven times nine)..
Last time I checked Neo frost wanted 8 digits, and 99999999 is the largest number you can have with only 8 digits (excluding decimals) and 1000000 is the smallest number you can have with 8 digits (including decimals).
So as a conclusion: No you are wrong and soranz was right, when trying to correct someone choose one who isn't smarter than you.
Well, there are numbers and there are numbers. For example a serial number or an account number etc. could have some leading zeros. In the general case the entire number could consist of zeros. The only thing we know is that each position contains a digit (0-9) and there are eight of them.
That makes the full range 00000000 to 99999999.
It may be necessary or useful to treat the input as a character string, rather than an integer.