19 Kasım 2009 Perşembe

C# Taban Aritmetiği Programı

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

namespace forOrnek
{
class Program
{
static void Main(string[] args)
{
// üs ve taban klavyeden girilecek
// Örneğin 5 ve 3 girilmişse 5 üzeri 3 değeri bulunacak

int i, us, taban, sonuc=1;
string strUs, strTaban;

Console.Write("Üs değerini giriniz: ");
strUs = Console.ReadLine();
us = Int32.Parse(strUs);

Console.Write("Taban değerini giriniz: ");
strTaban = Console.ReadLine();
taban = Int32.Parse(strTaban);

for (i = 1; i <= us; i++)
{
sonuc *= taban;

}
Console.WriteLine("{0} ın {1} kuvveti = {2}", taban, us, sonuc);
}
}
}

Hiç yorum yok:

Yorum Gönder