Math.Pow() Kullanmadan Tabanı Ve Üssü Girilen Sayıların Üssünü Alma

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

namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            int snc = 1;
            Console.Write("Tabanı giriniz :");
            int x = Convert.ToInt32(Console.ReadLine());
            Console.Write("Üssü giriniz :");
            int y = Convert.ToInt32(Console.ReadLine());
            for (int i = 1; i <=y ; i++)
            {
                snc = snc * x;
            }
            Console.WriteLine("sonuç: {0}",snc);
        }
    }
}

Yorum Gönder

0 Yorumlar