21 Aralık 2013 Cumartesi

C # PROGRAMI İLE ÖRNEK SORULAR-34

(pozitif-negatif)
using System;
using System.Collections.Generic;
using System.Text;
//CAFER KORKMAZ
//BU PROGRAM GİRİLEN SAYININ POZİTİF Mİ NEGATİF Mİ OLDUĞUNU SORGULAR
//13.03.2008

namespace NegatifPozitif
{
    class Program
    {
        static void Main(string[] args)
        {
            double sayi;
            string durum;
            Console.WriteLine("\n Bir sayı giriniz:\n");
            sayi = Convert.ToDouble(Console.ReadLine());
            if (sayi > 0)
            {
                durum = "pozitif";
                Console.WriteLine("\n {0} sayısı pozitif bir sayıdır!\n", sayi);
            }
            else if (sayi < 0)
            {
                durum = "negatif";
                Console.WriteLine("\n {0} sayısı negatif bir sayıdır!\n", sayi);
            }
            else
            {
                durum = "sifir";
                Console.WriteLine("\n {0} sayısı sıfıra eşittir!\n", sayi);
            }
            Console.ReadLine();
        }
    }
}

Hiç yorum yok: