Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to add number of digit in array

 
vineet walia
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help me out

what i want is ...

1.user enter no of digit of tat number
2.thn use enter tat number

so i want to store tat number in array..
please help me out i try some code but unable to do
>
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the final time through the loop,



always evaluates to zero

so num2 ends up being zero and this causes a division by zero error when you say

 
vineet walia
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim McGuire wrote:the final time through the loop,



always evaluates to zero

so num2 ends up being zero and this causes a division by zero error when you say



so how we can resolve this problem???
 
Janeice DelVecchio
Saloon Keeper
Posts: 1808
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could loop one less time and handle outside the loop or set an if statement inside the loop to take care of the last entry.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic