15 Nisan 2013 Pazartesi

103 - Değer Aralığı Alan Bir Fonksiyon... Math.Abs...


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {  // 5. Örnek: |x|-5 işlemi için x in 0-10 arası alacağı bütün değerlerde sonucu gösterecek olan program? 

            int x = 0;
            int sonuc = 0;
            while (x <= 10)
            {
                sonuc = Math.Abs(x) - 5; 
                Console.WriteLine("|" + x + "|-5 = " + sonuc);
                x++;
            }

            Console.ReadKey();
        }
    }
}