您的位置:首页 > 编程语言 > C#

C#趣味程序---个位数为6,且能被3整出的五位数

2015-06-28 14:27 417 查看
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = 0;
            int k;
            for (int i = 1000; i < 9999; i++)
            {
                k = i * 10 + 6;
                if (k % 3== 0)
                {
                    Console.WriteLine(k);
                    count++;
                }
            }
            Console.WriteLine(count);   
        }
    }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: