当前位置:编程学习 > C#/ASP.NET >>

求C#小算法程序!!!!

用控制台编写 程序

 一,输入的数字是198

 输出的数字是891

二一   2  3  4  5  6  7  8  9  10
     4  6  8  10 12 14 16 18 20
     8  9  12 15 18 21 24 27 30
     10 。 。 。 。 。 。 。 。
     12 。 。 。 。 。 。 。。 。
     14 。 。 。 。 。 。 。 。
     16 。 。 。 。 。 。 。。 。
     18 。 。 。 。 。 。 。 。 。
     20 30 40 50 60 70 80 90 100
输出的数字如上

大哥们帮帮忙

追问:int step=i有何用意?
答案:最佳答案  请采纳并评价

1

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine().Trim();
            char[] c = input.ToCharArray();
            Array.Reverse(c);
            Console.WriteLine(new String(c));
            Console.ReadLine();
        }
    }
}

2.

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i <= 10; i++)
            {
                int step = i;
                for(int j = 0;j< 9;j++)
                    Console.Write("{0}\t",2*i+j*step);
                Console.WriteLine();
            }
            Console.ReadLine();
        }
       
    }
}

第一题会, 第二题没懂意思呢.

第二题是什么意思?

上一个:C#怎么实现用户登录?
下一个:C#与PHP有何区别

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,