• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Having Trouble

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 2412
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dang, you are right. Thanks
 
Marshal
Posts: 76395
364
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 76395
364
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go through the methods of the Character class.
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic