每天我们都可以从服务器发送电子邮件的一定的限制.
任务:
编写将返回在极限的百分比发送的电子邮件的整数的函数.
例:
极限 - 1000;
电子邮件发送 - 101;
返回 - 10%;从10,1 = 10 // becouse整数
参数:
整数,限制;
整数,电子邮件的发送数今天;
如果:
参数
$发送= 0
,则返回消息: “没有发送电子邮件”;
发送> = $限制
参数
$,则返回消息: “达到每日限制”;
参数
$限制为空
,然后默认
$极限= 1000个
电子邮件;
祝你好运!
namespace CountEmails
{
public static class Program
{
public static string CountEmails(int sent, int limit)
{
// your code here, please check your arguments too!
}
}
}
namespace CountEmails
{
using NUnit.Framework;
using System;
[TestFixture]
public class SolutionTest
{
public void ShouldRoundUp()
{
Assert.AreEqual("10%", Program.CountEmails(100,1000));
}
}
}
本博客所有编程题目及答案均收集自互联网,主要用于供网友学习参考,如有侵犯你的权益请联系管理员及时删除,谢谢
题目收集至https://www.codewars.com/
https://www.codewars.com/kata/how-many-e-mails-we-sent-today