Last active
April 17, 2021 15:39
-
-
Save pertsevds/f4e20ec4252666576d782cdc89584073 to your computer and use it in GitHub Desktop.
Pluralize rubles C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Pluralize | |
{ | |
public static class PluralizeTask | |
{ | |
public static string PluralizeRubles(int count) | |
{ | |
if (count % 10 == 1 && count % 100 != 11) | |
return "рубль"; | |
if (Array.IndexOf(new[] { 2, 3, 4 }, count % 10) != -1 && | |
Array.IndexOf(new[] { 12, 13, 14 }, count % 100) == -1) | |
return "рубля"; | |
return "рублей"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment