+ 1
Why my this code show exception???
https://code.sololearn.com/cs9PQUt2CHtL/?ref=app Donna [A^dr3w] Pro Coder Gaurav Agrawal
4 Antworten
+ 16
● item[i]= sc.next(); //try this change
+ 6
Harsh Agrawal First of all don't create so many inputs because it will be complicated for the user to enter like that...
It is shows input mismatch exception when the user has not written the input in the required way..
+ 4
Your code looks no problem to me.
input at separate lines for code playground
By the way, why keep doing this:
namt+= tamt+0.08*tamt;
at line 40? It makes the namt a sum of geometric sequence of total amount. Doesn't looks logical.
I think you want to do this once only outside the for loop, and if it's a discount you don't += and +tamt, just
namt = 0.08*tamt
+ 2