SIDEBAR
»
S
I
D
E
B
A
R
«

Girilen 2 sayının 3′e ve 5′e Bölünebilirliğini Hesaplayan Program
Ara 23rd, 2009 by Özcan BAYĞUŞ

int toplam, sonuc = 0, top5 = 0, top3 = 0;
Console.Write("Bir sayı giriniz: ");
int sayi1 = Convert.ToInt32(Console.ReadLine());
Console.Write("bir sayı daha giriniz: ");
int sayi2 = Convert.ToInt32(Console.ReadLine());
for (toplam = sayi1; toplam < sayi2; toplam++)
if (toplam %5 == 0)
{
top5 = top5 + toplam;
}
else if (toplam %3 == 0)
{
top3 = top3 + toplam;
}
else
{
sonuc = sonuc + toplam;
}
Console.Write("3E bÖLünenLer : {0}\n5e BölüNenLer : {1}\n SayıLarın TopLamı : {2}",top3, top5, sonuc );
Console.ReadLine();

Sayı bulma oyunu
Ara 23rd, 2009 by Özcan BAYĞUŞ


Console.WriteLine("Bir ile yüz arasnda bir sayı tutun");
int küçük = 1, büyük = 100, sayı;
string durum;
Random rasgele = new Random();
int sayaç = 0;
for (int i = 1; i <= 20; i++)
{
sayı = rasgele.Next(küçük, büyük);
sayaç++;
if (küçük==büyük)
{
Console.WriteLine("Sayınız : "+küçük);
break;
}
Console.WriteLine("Sayınız " + sayı + " mı ?");
Console.WriteLine("\nKüçükse K ye Büyükse B ye Bildiysen E ye basın :\n");
durum = Console.ReadLine();
if (durum == "K" || durum == "k")
büyük = sayı - 1;
if (durum == "B" || durum == "b")
küçük = sayı+1;
if (durum == "E" || durum == "e")
{
Console.WriteLine("Ben bu işi biliyorum :) ");
break;
}
if (büyük == 0)
{
Console.WriteLine("Sayınız : 1 dan küçük olamaz.");
break;
}
} Console.WriteLine("Oyunu oynadığınız için teşekkür ederim " + sayaç + " denemede buldum");

Console Ekranında Dört İşlem
Ara 23rd, 2009 by Özcan BAYĞUŞ

string islem;
Console.WriteLine("Toplama İşlemi İçin \"T\"ye basın");
Console.WriteLine("Çıkarma İşlemi İçin \"Ç\"ye basın");
Console.WriteLine("Çarpma İşlemi İçin \"X\"e basın");
Console.WriteLine("Bölme İşlemi İçin \"B\"ye basın");
islem = Console.ReadLine();
if (islem == "T")
{
Console.WriteLine(Int32.Parse(Console.ReadLine()) + Int32.Parse(Console.ReadLine()));
}
if (islem == "Ç")
{
Console.WriteLine(Int32.Parse(Console.ReadLine()) - Int32.Parse(Console.ReadLine()));
}
if (islem == "X")
{
Console.WriteLine(Int32.Parse(Console.ReadLine()) * Int32.Parse(Console.ReadLine()));
}
if (islem == "B")
{
Console.WriteLine(Int32.Parse(Console.ReadLine()) / Int32.Parse(Console.ReadLine()));
}

Büyük sayıyı çıkartan program
Ara 23rd, 2009 by Özcan BAYĞUŞ

Form a iki adet textBox Bir adet button ekleyin ve buttonun Click olayına aşağıdaki kodu yazın.
int a, b;
a = Int32.Parse(textBox1.Text);
b=Int32.Parse(textBox2.Text);
if(a>b)
MessageBox.Show(Convert.ToString(a-b));
else
MessageBox.Show(Convert.ToString(b - a));

Çıkarma İşlemi
Ara 23rd, 2009 by Özcan BAYĞUŞ

Form a iki adet textBox Bir adet button ekleyin ve buttonun Click olayına aşağıdaki kodu yazın.

MessageBox.Show(Convert.ToString(Int32.Parse(textBox1.Text)-Int32.Parse(textBox2.Text)));

Toplama İşlemi
Ara 23rd, 2009 by Özcan BAYĞUŞ

Form a iki adet textBox Bir adet button ekleyin ve buttonun Click olayına aşağıdaki kodu yazın.

MessageBox.Show(Convert.ToString(Int32.Parse(textBox1.Text)+Int32.Parse(textBox2.Text)));

1 den 100 e kadar tek sayıları yazdırmak
Ara 23rd, 2009 by Özcan BAYĞUŞ

for (int s = 1; s <= 100; s=s+2)
{
Console.WriteLine(s.ToString());
}

1 den 100 e kadar çift sayıları yazdırmak
Ara 23rd, 2009 by Özcan BAYĞUŞ

for (int s = 2; s <= 100; s=s+2)
{
Console.WriteLine(s.ToString());
}

1 den 10 a kadar olan sayıları toplama
Ara 23rd, 2009 by Özcan BAYĞUŞ

int t=0;
for (int s = 1; s <= 10; s++)
{
t = t + s;
}
Console.WriteLine(t.ToString());

1 den 10 a kadar olan sayıları yazdırmak.
Ara 23rd, 2009 by Özcan BAYĞUŞ

for (int s = 1; s <= 10; s++)
{
Console.WriteLine(s.ToString());
}

»  Substance:WordPress   »  Style:Ahren Ahimsa