+ 1

Check out this problem and help me to improve it

program is to print a no. in words. I am getting some error if I am giving the input greater than 900 crore , but that is not beyond the storing limit of integers . Output is coming for 105 crores, the error is " Input mismatch Exception" 🤔🤔🤔 please check it out. https://code.sololearn.com/c0XJxaeZbUZM/?ref=app

23rd Dec 2017, 6:29 PM
Mr.Curious
Mr.Curious - avatar
10 Réponses
+ 10
InputMismatchException occurs when the program doesn't get the expected type of input. int data type can hold upto a specific range. Print out the value of Integer.MAX_VALUE and INTEGER.MIN_VALUE to know the range. If the user input exceeds this range, it can't be assigned as an int variable. For too large numbers, consider looking into BigInteger class, or treat the number as a String.
23rd Dec 2017, 6:58 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 18
https://code.sololearn.com/chT7ny6A83MJ/?ref=app //as suggested by yasmin //214 crores (approx) ... integer type can hold
23rd Dec 2017, 7:03 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 16
its gaurav , ! (!gaurab) @yasmin , //ppl will never write my name correctely ... nothin can be done // (name.equals ("Gaurav")||name.equals ("gaurav")) must return true
24th Dec 2017, 7:21 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 15
// a good code for that ... see this ☺ //-By Gawen https://code.sololearn.com/c4Wpkowl2m87/?ref=app
23rd Dec 2017, 6:41 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 15
i think u should say thanks to yasmin , as she telled u to how remove those errors & check when errors like this occur ☺ //& its Gaurav , !Gaurab
24th Dec 2017, 6:49 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 14
a correction wait , i mean ! ("!Gaurab") //bcz u were saying me !Gaurab initially 😃😂 , when say Gaurav , then "Gaurav" & when !Gaurab , then "!Gaurab" //yeah , it was just a typo error //btw i have a challenge link for u https://www.sololearn.com/Discuss/951797/?ref=app
24th Dec 2017, 7:53 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 10
@ !Gaurab, not a big deal. But thanks for your courtesy ^_^ @Rahul, glad it helped :)
24th Dec 2017, 7:18 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 9
@ !Gaurab, I know your name but since Gaurab is false, !Gaurab is true. And FYI, !(!Gaurab) is equivalent to Gaurab :D
24th Dec 2017, 7:43 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 1
@Yasmin ,thanks for the explanation
24th Dec 2017, 5:52 PM
Mr.Curious
Mr.Curious - avatar
0
@ Gaurav ,both codes do the same work and Thanks for clearing my doubt
24th Dec 2017, 3:56 AM
Mr.Curious
Mr.Curious - avatar