• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Puzzled  RSS feed

 
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
 
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
 
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.
 
He's my best friend. Not yours. Mine. You can have this tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!