File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modulus

 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use Modulus but I cannot get my progam to compile. I seen somewhere on the internet that I should use the format 10 % n, and on the other hand I was shown to use 10 modul n or something like that and it dont work give a compile error Here the statement.

if((10 % n) = 0)

it does not recognize the % symbol. I have not imported anymore libraries. I tried to use
import <java.lang.math.*> but it said that it did not exist.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12017
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) What EXACTLY does the compiler error state?
2) Remember that java is CASE SENSITIVE. math is NOT the same as Math, for example
3) Do you know the difference between "=" and "=="?
 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one moves the value over and one checks for equality.

okay I got that, now im getting a divide by zero error and I know why.
[ May 31, 2007: Message edited by: James Hambrick ]
 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im trying to do the Java1b program under Cattle Drive. I got the first part but the formattimg is getting me. I guess Im making it more difficult then it really is.

http://www.javaranch.com/hundred.jsp
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic