8 Ağustos 2016 Pazartesi

Dizi Kullanarak Sayı Değerine Göre Gün İsmi Yazdırma

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;//http://gorselprogramlamaogreniyorum.blogspot.com.tr/
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
 public partial class Form1 : Form
 {
 public Form1()
 {
 InitializeComponent();
 }



private void button1_Click(object sender, EventArgs e)
 {
 textBox2.Text = "";//http://gorselprogramlamaogreniyorum.blogspot.com.tr/
 string[] gunler = { "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi", "Pazar" };
 int girilen=Convert.ToInt32(textBox1.Text);
 if (girilen > 0 && girilen < 8) textBox2.Text = gunler[girilen - 1].ToString();
 else MessageBox.Show("Lütfen 1-7 arası sayı giriniz");
 //http://gorselprogramlamaogreniyorum.blogspot.com.tr/
 }
 }
}

Hiç yorum yok: