Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Xml;
- using System.Text.RegularExpressions;
- public class Program
- {
- public static void Main()
- {
- string numb;
- do
- {
- Console.WriteLine("Enter input: ");
- numb = Console.ReadLine();
- Console.WriteLine("Format input: " + sepMoney(int.Parse(numb)));
- Console.WriteLine();
- Console.WriteLine();
- }
- while (numb != "666");
- }
- private static string sepMoney(int numb)
- {
- char sepChar = ',';
- string money = "";
- int sepAmount = 1000;
- while ((numb % sepAmount) > 100)
- {
- money = string.Format("{1}{2}{0}", money, numb % sepAmount, sepChar);
- numb = numb / sepAmount;
- }
- if (numb > 0)
- money = string.Format("{0}{2}{1}", numb, money, sepChar);
- if (money[money.Length - 1] == sepChar)
- money = money.Substring(0, money.Length - 1);
- return money;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement