Last active
March 26, 2019 21:03
-
-
Save aysegulsarikaya/41186de9fb90a11fe48d090bd24f57e3 to your computer and use it in GitHub Desktop.
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
| static int max_basamak = 30; | |
| static string[] birler = { "", "Bir", "İki", "Üç", "Dört", "Beş", "Altı", "Yedi", "Sekiz", "Dokuz" }; | |
| static string[] onlar = { "", "On", "Yirmi", "Otuz", "Kırk", "Elli", "Altmış", "Yetmiş", "Seksen", "Doksan" }; | |
| static string[] binler = { "", "Septilyon", "Sekstilyon", "Kentilyon", "Katrilyon", "Trilyon", "Milyar", "Milyon", "Bin", "" }; | |
| static int[] basamak = new int[3]; | |
| static string SayiToYazi(string sayi) | |
| { | |
| string yaziyla = ""; | |
| sayi = sayi.PadLeft(max_basamak, '0'); | |
| for (int i = 0; i < max_basamak / 3; i++) | |
| { | |
| string temp = ""; | |
| basamak[0] = int.Parse(sayi.Substring(i * 3, 1)); | |
| basamak[1] = int.Parse(sayi.Substring(i * 3 + 1, 1)); | |
| basamak[2] = int.Parse(sayi.Substring(i * 3 + 2, 1)); | |
| if (basamak[0] == 0) | |
| temp = ""; | |
| else | |
| if (basamak[0] == 1) | |
| temp = "Yüz"; | |
| else | |
| temp = birler[basamak[0]] + "Yüz"; | |
| temp += onlar[basamak[1]] + birler[basamak[2]]; | |
| if (!string.IsNullOrEmpty(temp)) temp += binler[i]; | |
| if ((i > 1) && (temp.Equals("BirBin"))) temp = "Bin"; | |
| if (temp != "") yaziyla += temp; | |
| } | |
| return yaziyla; | |
| } | |
| private void btnYaziyla_Click(object sender, EventArgs e) | |
| { | |
| string[] tutarlar = new string[2]; | |
| if (txtSayi.Text.IndexOf(",") != -1) | |
| { | |
| tutarlar = txtSayi.Text.Split(','); | |
| } | |
| else | |
| { | |
| tutarlar[0] = txtSayi.Text; | |
| tutarlar[1] = ""; | |
| } | |
| if (tutarlar[1] != "") | |
| { | |
| lblYaziyla.Text = $"{SayiToYazi(tutarlar[0])} TL {SayiToYazi(tutarlar[1])} Kuruş "; | |
| } | |
| else | |
| lblYaziyla.Text = $"{SayiToYazi(tutarlar[0])} TL "; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment