C#:求解出n以内所有能被5整除的正整数的乘积

任务描述

本关任务:求解出n以内(包含n)所有能被5整除的正整数数的乘积s。

输入

从键盘输入一个正整数n,输入的n不超过100。

输出

对于每个样例n,输出n以内(包含n)所有能被5整除的正整数的乘积。

样例输入

19

####样例输出

s=750

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ch502

{

class Program

{

static void Main(string\[\] args)

{

/******begin*******/

int n =int.Parse(Console.ReadLine());

int i,s =1;

for( i=1;i<=n;i++){

if(i%5==0) s*=i;

}

Console.WriteLine("s={0}",+s);

/*******end********/

}

}

}

相关推荐
yue0082 小时前
winform控件篇-按钮
c#
DevOpenClub6 小时前
Markdown、HTML 和 PPT 如何稳定交付:文档转换任务的幂等发布流程
开发语言·前端·c#·html·powerpoint
软件黑马王子7 小时前
3.单例模式问题1:构造函数
开发语言·单例模式·c#
软件黑马王子8 小时前
4.单例模式问题2:重复挂载
开发语言·单例模式·c#
夏霞9 小时前
c# 不支持的目标框架 解决方案
开发语言·c#
软件黑马王子9 小时前
5.单例模式问题3:多线程问题
单例模式·前端框架·c#
geovindu9 小时前
CSharp: Template Method Pattern
开发语言·后端·c#·.net·模板方法模式·行为模式
CSDN_RTKLIB10 小时前
SetImpliedSelection
c#
软件黑马王子10 小时前
1.non-MonoBehaviour 单例模式泛型基类
unity·前端框架·c#
高彬10 小时前
SAP ECC6.0 对接 C# web Services服务
开发语言·前端·c#·sap