All pastes #2105341 Raw Edit

Mine

public text v1 · immutable
#2105341 ·published 2012-01-23 11:26 UTC
rendered paste body
/* İKİNCİ DERECEDEN BİR BİLİNMEYENLİ DENKLEM ÇÖZÜMÜ

* Bu program Hüseyin Çakanlı tarafından 23.01.2012 tarihinde

* ax2 + bx + c = 0 Denklemlerinin çözümü için
* örnek olarak Nesne Yönemli Olarak Yazıldı.

* C# Express ile Test Edilmiştir.

*/


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numeric;

namespace ConsoleApplication1
{

    class Denklem
    {
        int a;
        int b;
        int c;

        public String Hesapla(int a, int b, int c)
        {
            int delta = 0;
            delta = b * b - 4 * a * c;

            if (delta > 0)
            {
                Double x1 ,x2 ;

                x1 = (- b + Math.Sqrt(delta))/ (2*a);
                x2 = (- b - Math.Sqrt(delta))/ (2*a);

                return string.Format("Denklemin Cozum Kumesi : {0} , {1} Olarak Hesaplandi.", x1, x2);

            } else return " Denklemin Gercek Sayilarla Cozumu Yoktur." ;
        }//Hesapla
    }// Class Denklem
    
    class Program
    {
        static void Main(string[] args)
        {
            //Lokal Değişkenler Tanımlanıyor
            int Sayi1 = 0, Sayi2 = 0, Sayi3 = 0;
            //Nesne örneği oluşturuluyor.
            Denklem Denklem1 = new Denklem();

             do // Geçerli seçenek giriline kadar devam et
                {
                    Console.Clear();
                    Console.WriteLine();
                    Console.WriteLine(" 2.Dereceden 1 Bilinmeyenli Denklemde :");
                    Console.WriteLine("            (ax2 + bx + c = 0)");
                    Console.WriteLine(); 
                    Console.Write(" a Katsayisi (0 Cikis):");Sayi1 = int.Parse(Console.ReadLine());
                    if ( Sayi1 != 0)
                    {
                     Console.Write(" b Katsayisi          :");Sayi2 = int.Parse(Console.ReadLine());
                     Console.Write(" c Sabit Terimi       :");Sayi3 = int.Parse(Console.ReadLine());
                     String Sonuc = Denklem1.Hesapla ( Sayi1, Sayi2, Sayi3);
                     Console.WriteLine();
                     Console.WriteLine();
                     Console.WriteLine("{0}", Sonuc);
                     Console.ReadLine();

                   }
                 } while (Sayi1 != 0); // Programı sonlandır

        } // Main
    } //Class Program
} //NameSpace