Created
February 2, 2022 08:24
-
-
Save nesendal/4ca3d8a6a73eb93e36c8d59c117f7e8f to your computer and use it in GitHub Desktop.
Kullanıcıdan bir sayı alalım. Eğer sayı 2 basamaklı ise ekrana tersten yazdıralım. diğer durumlarda giriş başarılı değildi mesajı verelim.
This file contains 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 Ornek | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
//kullanıcıdan bir sayı alalım. Eğer sayı 2 basamaklı ise ekrana tersten yazdıralım. diğer durumlarda giriş başarılı değildi mesajı verelim. | |
int sayi; | |
Console.WriteLine("sayı giriniz:"); | |
sayi = int.Parse(Console.ReadLine()); | |
if (sayi.ToString().Length == 2) | |
{ | |
Console.WriteLine(TerseCevir(sayi)); | |
} | |
else | |
Console.WriteLine("başarısız"); | |
//nagihanesendal.blogspot.com | |
} | |
static string TerseCevir(int sayi) | |
{ | |
string tersi = ""; | |
string deger; | |
deger = sayi.ToString(); | |
for (int i = deger.Length - 1; i >= 0; i--) | |
{ | |
tersi += deger[i]; | |
} | |
return tersi; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment