No hair

I've been working on this code for a couple of days now and no longer have any hair. I want to evaluate a number to see if it is the same forward and backward. If not, the forward and backward numbers need to be added together and the sum needs to be evaluated. This process continues until a Palindromic number is reached.
I have several problems:
1) When I add the original and reverse numbers together , some how the original number is always zero.
2) I can't figure out the correct syntax for comparing the two numbers. I've tried compareTo (using Integers) and if int1=int2 then ...
3) Once the two numbers are compared, and I have the sum, I need to re-evaluate the sum.
I would like to get my code to work. I'm sure there is a more streamlined process, but I will try to streamline it after I learn more.
Thanks in advance.
import java.io.*;
import java.awt.*;
   public class reverse1  {
      public static void main(String [] args) throws IOException {
     BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
     int OriginalNum;  //the number that will be input by the user
     int numTry = 0;  //numbers of tries
     boolean foundIt = false;
     //read the input from the user
     System.out.print("Please enter a number: ");
     OriginalNum = Integer.parseInt(keyboard.readLine());
//checking if it is a single digit
     if (OriginalNum != 1) {
        foundIt = true;
//evaluate number to see if it is a palindrome
     //reverse number
     int ReverseNum = 0;
          while (OriginalNum != 0) {
          ReverseNum = ReverseNum*10 + OriginalNum%10;
          OriginalNum = OriginalNum/10;
     System.out.println("The original number is " +  OriginalNum + ".");
     System.out.println("The reverse number is " +  ReverseNum + ".");
     Integer Rnum = new Integer(ReverseNum);
     Integer Onum = new Integer(OriginalNum);
     if (OriginalNum == ReverseNum) {
        foundIt = true;
     //add the original and reverse numbers together
     int NSum = OriginalNum + ReverseNum;
     //output the answer
     System.out.println("The sum is " + NSum + ".");
     //evaluate if it is a palindrome
     //number of Tries
     numTry++;
     System.out.println("Tried " + numTry + " times.");
     if (foundIt) {
     System.out.println("It IS a palindrome!");
      }//end main
   }//end class

public class ReverseNum {
    public static void main(String[] args) {
        int original  = 125;      // Input.
        while(true) {
            int copy      = original;
            int reverse   = 0;
            while(copy != 0) {
                reverse  = reverse *10 +(copy %10);
                copy     = copy /10;
            if(original == reverse) {
                System.out.println("Palindrome!!!");
                break;
            } else {
                // Compute the sum and start again.
                original +=  reverse;
        System.out.println("Number = " +original);
}

Similar Messages

  • How can I move someone's hair from one photo to another and place it on another person?

    How can I move someone's hair from one photo to another and place it on another person?

    Duplicate post.

  • How can I move someone's hair from one photo to another and place it on another person? I have gone through every instructional video you have and have not been able to master this

    How can I move someone's hair from one photo to another and place it on another person? I have gone through every instructional video you have and have not been able to master this

    Open picture B, the one you wish to select the hair from to add to the picture.
    Use one of the selection tools, e.g. selection brush, lasso tool, to select the hair. You will see an outline ("marching ants") once the selection is complete
    Go to Edit menu>copy to copy the hair to the clipboard
    Open picture A, then go to Edit>paste
    Use the move tool to position the hair from picture B.
    In the layers palette you should see picture A as the background layer, and the hair (B) on a separate layer.

  • How to Make Hair Appear in Front of and Behind an MC Object?

    Hello again,
      I am making a character with lots of hair. I would like to know how to make the hair appear both in front of and behind the Movie Clip object.
      I'll explain further. I have the "frontHair" connected to the "head" MC. When I pivot the head, a bare spot shows in an outlined shape of the arms/legs/torso. I thought I'd remedy this by making "hairBack" and then layer it behind the object. This opens up a can of troubles.
      I can't seem to get the "hairBack" to appear behind the torso and arms. Also, the "frontHair" is now blocking me from grabbing onto the arms and legs.
      It's crucial that this character has all of the hair, but I can't seem to figure out how to make it happen.
      Please, help!
    Thank you,
       Mike
    p.s. While returning from a beer run, I thought about masking. I'm still trying to work out the logic on this one.

    Thank you for replying. II didn't know which specific layers and objects you were referring to, but I figured out the problem I was having.
      I used only one newly created "hair" object and set it to "Guide" to get it out of the way (in a sense). I then selected all the body parts (movie clips) that I could and selected "Move to Front" for each one. I used the Selection Tool to move the head (with connected hair) out of the way. After doing this I was able to select the "torso"; which was previously hidden behind the Armature Layer. I then put the head back in place and I was set to roll.
      Ah, but then I encountered another error. My animations are set to 24fps, but they are moving at least 10 times slower. This happens within Flash and in the exported swf files.
    The topic deals with "text field variable names" errors and compiler errors dealing with "Symbol 'fps' ".
    This is the address to that topic. http://forums.adobe.com/thread/1009225
    Thank you (again),
      Mike

  • I am pulling my hair out! I am using adobe indesign and just want to make a text box 'autofit text' as I change fonts a lot and want the font to automatically re-size as I change it. help help help please - I have latest version of indesign - thanks

    I am pulling my hair out! I am using adobe indesign and just want to make a text box 'autofit text' as I change fonts a lot and want the font to automatically re-size as I change it.
    Is it not possible to create a text box, fill it with dynamic (data driven) text, but make the font size either scale up or down automatically, so that the entire text box is filled? This is a feature in PrintShop Mail Pro called COPY FIT. but no such feature in Indesign??
    help help help please - I have latest version of indesign - thanks, DJ

    lol... it seems to work, but I have another huge problem!
    Apparently .CSV files cannot contain page breaks in the data! The data I am trying to merge is a 'letter', with paragraphs, line breaks, etc.,
    But, after data merging, it ignores page breaks and only merges the first paragraph of each letter. (sigh)
    Solution? Hopefully, an EASY solution. lol as we have thousands of records.
    Is there a third party indesign plugin that will allow .xml, or .xls data merge import??
    Thx,
    DJ

  • HT1349 My ipod was submerged in water monentarily. I have dried it with a hair dryer and set it in the sun for 1 hour. It now will turn on and only bring up the connect to itunes screen. My keypad is locked and will not unlock by connecting to itunes.

    My ipod was submerged in water momentarily. I have dried it with a hair dryer and have placed it in the sun for 1 hour.  It will now turn on but will only bring up the connect to itunes screen. When I connect to itunes it is not recognized because it is locked with a security code. I have tried to reset the ipod using the instructions in the user manual to no avail. The accessibility screen is functional because I can turn on/off the voice over and the black and white screen. I think I am making progress but cannot unlock it. Does anyone have any other suggestions? Thanks

    Unfortunately, using a hair dryer or placing the iPhone in sunlight, at best, will dry the outside of the device. If water got inside, it may still be possible that this water has not dried and can short out the internal battery or cause other circuit damage ... and what you are seeing may be the results of that. I would recommend that you leave the iPhone turned off and take it to your local Apple Store. They may be able to help, but I wouldn't expect them to offer you a replacement. Sorry!

  • This new version of FireFox is making me nutz! It is SUCKING 100% CPU time almost constantly. I could just pull my hair out. I wpdated once a month or so ag

    I tried to add this in the topic already open but it kept sending me through the unending rabbit holes!
    My question is: How do I figure out what release I was on, get rid of this one and got back to a functional firefox that moves in realtime. I already did all the reset and etc.... I just want to go back to the speed I had. This halting , hanging up misery of a browzer is Sad. I have had firefox for years and always recommended it ..... BUT NOT ANY MORE. I agree with the other poster ... there should be a rollback feature. Peoples time has value and right now FireFox is sucking the value down a rabbit hole.
    See Below Comment Feedback submitted before I finally got here:
    This new version of FireFox is making me nutz! It is SUCKING 100% CPU time almost constantly. I could just pull my hair out. I wpdated once a month or so ago and it slowed down..... but the latest update before I did the reset really slowed me down. I came here to fix it a couple of dayz ago and did the reset firefox and now it IS RUNNING SO POORLY AND SLOW I AM ABOUT TO KILL IT OFF MY MACHINE!!! Yes that is me yelling - and it happened in SSSSSSSSSSSSS LLLLLLLLL OOOOOOOO WWWWWWWWWW Motion. I have run all the security scans and cleanups ---this needs a fix ASAP!!! PS: The hang ups and slowness is EVERYWHERE I go. I only get speed doing programs not connected to ON LINE.

    Hello,
    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • My iPhone is stuck in headphone mode. I've tried inserting and removing headphone jacks, blowing compress air into jack opening, using warm air from hair dryer, but

    My iPhone is stuck in headphone mode. I've tried inserting and removing headphone jacks, blowing compress air into jack opening, using warm air from hair dryer, and a number of setting changes, but the iphone is still in headphone mode.

    it's a hardware issue
    https://discussions.apple.com/thread/1343532?start=315&tstart=0

  • I got some hair spray on my new retina display screen. What is the best way to remove.

    I got some hair spray on my new Mac Book Pro Retina Display. Any thoughts on the best way to remove?

    I would use this.  I use it on my MBPs and it does an excellent job.  I cannot say with authority that it will remove your hair spay residue.
    Ciao.
    http://www.soap.com/p/windex-for-electronics-aerosol-97299?site=CA&utm_source=Go ogle&utm_medium=cpc_S&utm_term=ASJ-294&utm_campaign=GoogleAW&CAWELAID=1323111033 &utm_content=pla&adtype=pla&cagpspn=pla&noappbanner=true
    I clicked the reply button too early.
    Message was edited by: OGELTHORPE

  • Using a hair-dryer to resurrect a dead iMac CTR!

    I visit this forum often enough to see how many people are finding it hard to get their old (but perfectly usable) iMac CTR to work again.
    Well, after putting in a new battery, my good old iMac G3 400 SE slot loader was still not booting. I knew everything worked. I turned it off for a day, and then it wouldn't boot up again. All I got was a green flicker as I tried to power on.
    Well, low and behold, I used a hair-dryer to warm up the inside of the system, and it booted up fine!
    Hopefully this might work for some others with presumable dead iMac G3s. But the question is why??? If I put the system to sleep I get the same "playing dead" iMac and have to wake it up again with the hair dryer. Any thoughts?

    Thanks for your input. Yes I did check a number of things, including all connectors fitting ok, but maybe I missed something. I did try swapping out even the logic boards and hard drives, to no avail. My guess it is something with the monitor itself, since the other components work fine, and only when the monitor is heated enough will it start.
    I have no problems with the computer otherwise, but I hate to waste electricity - it just can't sleep or it will play dead. Thanks again.
    I hope this might help others who might have the same problem thinking it is something wrong with the computer, when it is really the monitor. Go get those hair dryers revved!

  • I want to cut out a head from a photo and insert it into another photo again. In the head hair flying in the wind and the blue sky can be seen between the hairs. This blue sky I want to remove, so I can only use the head with hair flying in another photo.

    I want to cut out a head from a photo and insert it into another photo again. In the head hair flying in the wind and the blue sky can be seen between the hairs. This blue sky I want to remove, so I can only use the head with hair flying in another photo. Is it possible to simply delete this blue color of the sky?

    Make your selection and then use Refine Edge.
    See this video tutorial from Bob Gager.
    https://www.youtube.com/watch?v=xrl3Qwg6zSc

  • How do i Extract Hairs in Photoshop, as i don't have extract Filter in PHOTOSHOP CC.

    How do i Extract Hairs in Photoshop, as i don't have extract Filter in PHOTOSHOP CC.

    See:  Masking Basics in Photoshop CS5 | The Russell Brown Show | Adobe TV
    -Noel

  • Display problem: Hair INSIDE the LCD

    not exactly sure how this happened... or if my problem is actually a hair or an uncannily hairlike row of dead pixels, but there is a dark arc in the lower right hand corner of my screen, about 13mm from the right side that wasn't there yesterday.
    I have several questions:
    Is such a problem covered under the 1 year warranty of the powerbook?
    How does one go about making a warranty claim with apple? (i've never had a single problem with an apple product that i couldn't fix before this)
    What is the turnaround rate if apple can in fact fix my problem? (i'm a student and any time without my machine is bad)

    This will definitely be covered under warranty as the panel is supposed to be sealed.
    Apple can be pretty good about turn around time on these types of repairs. Plan to be without it for a week, including shipping time.

  • Can I mask out a stray hair strand in video clips???

    I have several clips with a person with one small but noticeable stray hair extending below the side of their glasses over their cheekbone.  Is there a way to have the skin tone intelligently mask out/replace that part of the hair over the facial area; can I select it in some way/is there a specific effect to do this? Quick help deeply appreciated!

    If you have After Effects, I recommend doing this in After Effects. If you bring the question to the After Effects forum, we can help there.

  • Which is better for masking hair? Raw or Jpg ?

    Hi,
    I know that when it comes to color grading it's much better to work on a raw file.
    Does it make a big difference also for masking out hair ?
    Thanks!

    Hi im-mor-tal,
    It shouldn't make a huge difference, you may still have a higher quality RAW file than jpg, and in those cases you would be able to create a tighter, more accurate mask.
    But mostly I'd say that you could accomplish similar results with the JPG as you could with a RAW with masking.
    Regards

  • Purple hair! - colors printing wrong w/ iPhoto '08 and Canon MP780

    I am trying to print some photos of my strawberry-haired daughter and her hair keeps coming out electric purple. It looks very Warhol, but I wasn't reallly going for that effect... Other dark bits in the pictures are coming out purple too.
    This has only happened since upgrading to '08. I am still using 10.4.11. I looked for an updated driver on the Canon website, but the latest update is just for Leopard. I've tried printing through the file menu as well as the print button in iPhoto. I get a range of larger or smaller purple highlights, but can't seem to get it to come out without purple hair.
    Any ideas? I don't know enough about tweaking settings randomly to get beyond where I've gotten (about a dozen tries with paper options, color sync vs. BJ Standard in Color Options, printing from a PDF).
    Thank you.
    d.

    Danika:
    Welcome to the Apple Discussions. Have you tried cleaning the printer's nozzels with it's printer utility? That happened to me when one of the colors got plugged and the prints were not unlike you are experiencing.
    Happy Holidays
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

Maybe you are looking for

  • German Special Characters not displayed correctly in RTF  using code

    Hi , In my code we are using webdynpro method WDResourceFactory.createResource( byte[] data, String resourceName,WDWebResourceType Type) Here in our code we are implementing this as ITemplateElement templateEl = wdContext.currentTemplateElement(); WD

  • Scanning using HP 7510 stopped working after App Store HP update on 10/23

    I am still using OS X 10.8.5. Last week I installed an update after a notification from the App Store that there was one for my HP Photosmart 7510 all-in-one. Now I can still print but cannot scan to the computer. I have used HP Scan 3, Image Capture

  • Incoming email message area blank

    On my leopard machine I have one person who sends me email regularly and the message area of the email is blank even tho I know she has sent a message. If I forward that email to myself and download it on my laptop with OSX 10.4.11, the message shows

  • Where is the refresh button for my podcasts

    Got a new computer, downloaded iTunes, now my podcast page does not have a refresh button and my episodes are out of date

  • IOS 8.1.3 update has caused my iPhone 4S to die.

    Does anyone have a similar experience?  After setting up my phone to install iOS 8.1.3, it crashed midway through the install and asked me to plug into iTunes for a restore.  This worked after many failed attempts, however the phone did not work as w