24848人加入学习
(72人评价)
C#编程-第一季-编程基础-宇宙最简单2021最新版

制作完成于2021年10月10日,使用Visual Studio 2019

价格 免费
using System;

namespace _023_编程题
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int tempn = n;
            int number = 0;
            // 3617
            // 7 1 6 3
            // 7*10 10
            //71*10 710
            //7160
            //7163
            while (tempn != 0)//从低位到高位
            {
                int i = tempn % 10;
                number *= 10;
                number += i;
                //i=7  number=7
                //i=1 70 71
                tempn /= 10;
            }
            if (number == n)
            {
                Console.WriteLine("yes");
            }
            else
            {
                Console.WriteLine("no");
            }
        }
    }
}

 

[展开全文]

static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int m = n;
            string s = "";
            while (n != 0)
            {
                s += Convert.ToString(n % 10);
                n /= 10;
            }

            if (Convert.ToString(m) == s)
            {
                Console.WriteLine("您输入的数{0}是回文数", n);
            }
            else { Console.WriteLine("您输入的数不是回文数"); }
        }

[展开全文]

 int num = Convert.ToInt32(Console.ReadLine());
            int i = 0;
            int x=0;
            int sum = 1;
            int y = num;
            int z = num;
            while (num != 0)
            {
               
                 i = num % 10;
              
                sum *= 10;
                num /= 10;
            }
            while (y != 0)
            {
                sum /= 10;
                i = y % 10;
                x = i * sum + x;
                
               y /= 10;
            }
            if (x == z)
                Console.WriteLine("yes");
            else
                Console.WriteLine("no");
 

[展开全文]


            int num = Convert.ToInt32(Console.ReadLine());
            int num2 = num;
            int newnum = 0;
            while (num2 != 0)
            {
                int ge = num2 % 10;
                num2 = num2 / 10;
                newnum = (newnum + ge) * 10;
                //Console.WriteLine(newnum);
            }
            newnum = newnum / 10;
            //Console.WriteLine(newnum);
            //Console.WriteLine(num);
            if (newnum == num)
            {
                Console.WriteLine("yes");
            }
            else
            {
                Console.WriteLine("no");
            }

[展开全文]
wei央 · 2022-05-24 · 065-编程题 0

//3617

//7  1  6  3

 

//0*10

+7

//7*10

+1

//71*10

+6

//716*10

+3

int i=n%10;

number*=10;

number+=i;

n=n/10;

 

[展开全文]
LSCqmu · 2022-07-21 · 065-编程题 0

第六十六课  编程题

1. 回文数指正序(从左到右)和倒序(从右到左)读都是一样的整数。输入一个数,判断是否是回文数。输入的整数大于0,小于1000000。如果是回文数输出yes,不是则输出no。

样例输入 2397    输出 no

样例输入2992     输出yes

int n= Convert.ToInt32(Console.ReadLine());
int b = n;
int number = 0;
while (b != 0)
{
    int temp = b % 10;
    number = number * 10;
    number = number + temp;
    b = b / 10;
}
Console.WriteLine(number);
if (number == n)
{
    Console.WriteLine("yes");
}
else
{
    Console.WriteLine("no");
}

编程如果慢慢学还蛮有意思的。

 

[展开全文]

授课教师

SiKi学院老师

课程特色

下载资料(1)
视频(118)
图文(1)