判断是否为回文数+求一个序列的第30个数

来源:互联网 发布:windows键盘钩子程序 编辑:程序博客网 时间:2024/09/21 09:26
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace _11111{    class Program    {        static void Main(string[] args)        {            string c;            int i, j;            bool falg;            falg=true;            Console.Write("输入一个字符串:");            c = Console.ReadLine();            char[] s = c.ToCharArray();            for (j = 0; j < s.Length / 2; j++)            {                if (s[j] != s[s.Length - j - 1])                {                 falg = false;                break;                                }                                }            if (falg)            {                Console.WriteLine("是回文数。");            }            else            {                Console.WriteLine("不是回文数。");            }            Console.ReadLine();        }    }}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace _11111{    class Program    {        static void Main(string[] args)        {            int c=0,a=1, b=1;            for (int i = 0; i < 28; i++)            {                c = a + b;                a = b;                b = c;            }                       Console.WriteLine("第30个数为:{0}",c);                    Console.ReadLine();        }    }}


0 0