• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

algorithm

 
Ranch Hand
Posts: 83
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

any help appreciated, not getting this program to run

 
Bartender
Posts: 11226
91
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you think it's working? What input are you giving it and what output do you get?
 
Carey Brown
Bartender
Posts: 11226
91
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are not doing anything with the return value from isPrime().
 
Carey Brown
Bartender
Posts: 11226
91
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not a good idea generally to leave out braces, and especially if you're just starting out. Proper indentation is essential also.
 
Carolin Sha
Ranch Hand
Posts: 83
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

I input a number, however no output seen.
 
author
Posts: 23965
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carolin Sha wrote:
I input a number, however no output seen.



What output do you expect? ... And where in the code, do you expect this output to be produced?

Henry
 
Carey Brown
Bartender
Posts: 11226
91
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:You are not doing anything with the return value from isPrime().

 
Marshal
Posts: 82459
594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:. . . . Proper indentation is essential also. . . .

Proper indentation would have shown the error in that loop, too.
 
Sheriff
Posts: 9090
670
Mac OS X Spring VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carolin Sha wrote:


Looking solely to this expression it looks nonsensical. As an analog, the question could be, "Carolin are you Carolin"?
That demonstrates how classes and variables naming (naming overall) are critical to system's clarity. It is easy enough to make program look puzzling and nonsensical.
 
Campbell Ritchie
Marshal
Posts: 82459
594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

An hour ago, I wrote:. . . .  error in that loop, too.

Maybe there isn't an error. It goes to show how important code formatting is.
 
reply
    Bookmark Topic Watch Topic
  • New Topic