import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);
         System.out.print("Enter a number: ");
         int number = input.nextInt();

         input.close();

         System.out.println(number + " is a palindrome: " + isPalindrome(number));
     }

     public static int reverse(int number)
     {
         String strOfNumber = "";
         if(number < 10)
             strOfNumber += number + "";
         else
             strOfNumber += "" + number % 10 + reverse(number / 10);
         return Integer.parseInt(strOfNumber);
     }

     public static boolean isPalindrome(int number)
     {
         int backupNumber = reverse(number);
         if(number == backupNumber)
             return true;
         else
             return false;
     }
 }

HW5.3的更多相关文章

  1. HW5.36

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  2. HW5.35

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  3. HW5.34

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  4. HW5.33

    import java.util.Calendar; public class Solution { public static void main(String[] args) { long tot ...

  5. HW5.32

    public class Solution { public static void main(String[] args) { int n1 = (int)(Math.random() * 5 + ...

  6. HW5.31

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  7. HW5.30

    public class Solution { public static void main(String[] args) { for(int i = 3; i <= 1000; i++) i ...

  8. HW5.29

    public class Solution { public static void main(String[] args) { int n1 = (int)(Math.random() * 5 + ...

  9. HW5.28

    public class Solution { public static void main(String[] args) { System.out.printf("%s\t%s\n&qu ...

  10. HW5.27

    public class Solution { public static void main(String[] args) { int totalCount = 0; int lineCount = ...

随机推荐

  1. linux awk命令学习

    . awk的运行过程 ) awk_script的组成: ① awk_script可以由一条或多条awk_cmd组成,两条awk_cmd之间一般以NEWLINE分隔 ② awk_cmd由两部分组成: a ...

  2. poj 2778 DNA Sequence ac自动机+矩阵快速幂

    链接:http://poj.org/problem?id=2778 题意:给定不超过10串,每串长度不超过10的灾难基因:问在之后给定的长度不超过2e9的基因长度中不包含灾难基因的基因有多少中? DN ...

  3. 说说对C语言指针的理解

    指针困扰了一些学习编程的人,或许你的老师会告诉你,指针比较难理解. 我当时被老师的话唬住所以学习指针那章的时候都没心情听课.(说得像讲别的内容时我听了似的,开玩笑) 导致了学习链表的时候各种卧槽. * ...

  4. FolderBrowserDialog组件选择文件夹

    1.选择路径 this.folderBrowserDialog1.ShowDialog(); if (this.folderBrowserDialog1.ShowDialog() == DialogR ...

  5. 开发设计模式(七)工厂模式(Factory Method Pattern)

    工厂模式是我们最常用的模式了,著名的Jive论坛 ,就大量使用了工厂模式,工厂模式在Java程序系统可以说是随处可见. 为什么工厂模式是如此常用?因为工厂模式就相当于创建实例对象的new,我们经常要根 ...

  6. Xcode - 必不可少的插件

    1. backLight 2.  BBUDebuggerTuckAway 3. Cocoapod 4. FuzzyAutoComplete 5. HOStringSense 6. KissImageN ...

  7. C#<热血传奇>服务端源代码再次给力更新

    前段时间一直在忙公司项目,最近抽点空稍微把部分代码重新整理一下(代码太久没碰很多地方都忘记了 囧~~~) 此次还是更新服务端,并修正上一版里面存在的很多指针 异常BUG...  (代码比较烂,还请各位 ...

  8. [转载]C#.NET中Dns类的常用方法及说明

    IP是一种普遍应用于因特网.允许不同主机能够相互找到对方的寻址协议.IP地址由4个十进制的数字号码所组成,而每一个号码的值介于0~255之间,它虽然解决了网络上计算机的识别问题,但是IP地址确不容易记 ...

  9. Weex详解:灵活的移动端高性能动态化方案

    原文地址:http://www.infoq.com/cn/articles/introducing-weex 在2016年4月份的QCon上,阿里巴巴资深总监,淘宝移动平台及新业务事业部.阿里百川负责 ...

  10. easyui源码翻译1.32--Tree(树)

    前言 使用$.fn.tree.defaults重写默认值对象.下载该插件翻译源码 树控件在web页面中一个将分层数据以树形结构进行显示.它提供用户展开.折叠.拖拽.编辑和异步加载等功能. 源码 /** ...