• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Puzzled

 
Iain Palmer
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing the assignment Java-4(Say) and I can't get the correct output for nos 11-19, I've got all the rerst to print-out correctly but everytime i try to get 11-19 to printout I can't I've tried an if statement, an if-else statement,a while statemnt and a do-while statment and am running out of ideas. I haven't used a for loop because it doesn't have to loop round
 
Iain Palmer
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't Worry I was using wrong operators, I've sorted it out now
 
K Riaz
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post your code using CODE tags and expected output and we can have a look

EDIT: OK...
[ March 29, 2005: Message edited by: Kashif Riaz ]
 
Iain Palmer
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here' s the program I am using JOptionPane to get the input because I'm using either NetBeans or JCreator
 
Iain Palmer
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it wrong. The output is fine if I take out the System.exit(0) for the If statment but if i enter 12 I get
Twelve
Ten
Two
 
Kareem Qureshi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your if condition is wrong
it should be if (no >10 && no <20 ) instead of if (no >10 || no >20 )

Hope this helps
Thanks
Kareem
[ March 29, 2005: Message edited by: Kareem Qureshi ]
 
Iain Palmer
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you it works I thoght it had to be something simple but I just couldn't see. Sorry for the late reply but have been busy.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic