Artık Yıl Bulma — Csharp

Artık Yıl Bulma — Csharp

artikYil

[code lang=”csharp”]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Artik_Yil_Bulma
{
public partial class Form1 : Form
{
public Form1()
{//www.gorselprogramlama.com
InitializeComponent();
}

bool ArtikYilBulma(int yil)
{
bool sonuc;
if (yil % 4 == 0) // 4 e bölünüyor ise
{
sonuc = true;
if (yil.ToString().EndsWith("00")) // son 2 hanesi sıfırsa
{
if (yil % 400 == 0) // 4 e tam bölünüyorsa
sonuc = true;
else
sonuc = false;
}
}
else
sonuc = false;//www.gorselprogramlama.com

return sonuc;
}

private void button1_Click(object sender, EventArgs e)
{
if (ArtikYilBulma(int.Parse(textBox1.Text)))
{
label2.Text = "Sonuç : Artık yıldır";
}
else//www.gorselprogramlama.com
{
label2.Text = "Sonuç : Artık yıl değildir";
}

}
}
}
[/code]

artikYil1

Projeyi İNDİR

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir