Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Having Trouble  RSS feed

 
Luis Alejandro Perez Leon
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm really new in programming, so I don't know fancy codes. Now, my code isn't compiling. I'm getting this error
C:\Users\luis\SkyDrive\Documents\Euler\Euler506.java:44: error: unexpected type
(n)%(123454321)=n;
--- ^
required: variable
found: value
1 error
Here's my code

 
Keith Lynn
Ranch Hand
Posts: 2409
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The variable always appears on the left-hand side of an assignment statement. You are putting an operation on the left hand side
 
Luis Alejandro Perez Leon
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dang, you are right. Thanks
 
Campbell Ritchie
Marshal
Posts: 55711
163
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, he was right. Welcome to the Ranch

I am afraid your code is illegible because you haven't indented or spaced it out properly. We have some suggestions here. if(c==49){c=1;} is particularly difficult to read. It also suggests there is a much simpler and more elegant way to convert those chars to ints.
 
Luis Alejandro Perez Leon
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yea, I'm still learning elegant code. I'll clean it a bit than I'll repost it. By the way, how do I transform the char to Int without using the ASCII?
 
Campbell Ritchie
Marshal
Posts: 55711
163
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go through the methods of the Character class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!