math.pow in C# using loop
C#
static float CalculatePower(float x, int y)
{
float temp;
if (y == 0)
return 1;
temp = CalculatePower(x, y / 2);
if (y % 2 == 0)
return temp * temp;
else
{
if (y > 0)
return x * temp * temp;
else
return (temp * temp) / x;
}
}static void Main(string[] args)
{
float x = float.Parse(Console.ReadLine());
int y = int.Parse(Console.ReadLine());
float result = CalculatePower(x, y);
Console.WriteLine("{0} to the power of{1} is {2} ", x, y, result);
}
Also in C#:
- Title
- unity draw wire square
- Category
- C#
- Title
- codecademy
- Category
- C#
- Title
- c# listview
- Category
- C#
- Title
- wpf restart application c#
- Category
- C#
- Title
- using serial port in c#
- Category
- C#
- Title
- how to trim path in C#
- Category
- C#
- Title
- how to convert object in string JSON c#
- Category
- C#
- Title
- asp textarea
- Category
- C#
- Title
- c# property get set
- Category
- C#
- Title
- bash if null or empty
- Category
- C#
- Title
- c# index in select
- Category
- C#
- Title
- .net core convert keycollection to array
- Category
- C#
- Title
- populate combobox from array c#
- Category
- C#
- Title
- C# .NET Core linq Distinct
- Category
- C#
- Title
- delay in unity
- Category
- C#
- Title
- button color uwp c#
- Category
- C#
- Title
- linq c# object except two lists
- Category
- C#
- Title
- c# groupby date
- Category
- C#
- Title
- webclient c# example post
- Category
- C#
- Title
- player script unity
- Category
- C#
- Title
- unity how to make jump script
- Category
- C#
- Title
- unity c# is not equal to
- Category
- C#
- Title
- Linq - Random Elements
- Category
- C#
- Title
- c# print to console
- Category
- C#
- Title
- Request.ServerVariables["HTTP_X_FORWARDED_FOR"] get only one ipaddress
- Category
- C#
- Title
- get waht is differnt between two arrays c#
- Category
- C#
- Title
- c# main method
- Category
- C#
- Title
- unity cycle children
- Category
- C#
- Title
- c# odd even median
- Category
- C#
- Title
- unity how to get transform scale
- Category
- C#
- Title
- unity connect to firebase
- Category
- C#
- Title
- system.io.directorynotfoundexception c#
- Category
- C#
- Title
- how to find object by ag unity
- Category
- C#
- Title
- wpf textblock line break code behind
- Category
- C#
- Title
- Rigidbody.addforce
- Category
- C#
- Title
- dont destroy on load unity
- Category
- C#
- Title
- c# reflection create generic type
- Category
- C#
- Title
- eventos c#
- Category
- C#
- Title
- how to add to a list c#
- Category
- C#
- Title
- get setter c# model
- Category
- C#
- Title
- c# check if type implements interface
- Category
- C#
- Title
- c# mathf.ceiling
- Category
- C#
- Title
- calculate impact damage + unity
- Category
- C#
- Title
- .net core cli
- Category
- C#
- Title
- isprime c#
- Category
- C#
- Title
- c sharp add item to dictionary
- Category
- C#
- Title
- how do i foreach c#
- Category
- C#
- Title
- datatable return column names
- Category
- C#
- Title
- C# check if is first run
- Category
- C#
- Title
- C# resize window without title bar
- Category
- C#
- Title
- kill child C#
- Category
- C#
- Title
- unity get list length
- Category
- C#
- Title
- c# creating a data recovery software
- Category
- C#
- Title
- c# get date without time
- Category
- C#
- Title
- c# Sleep
- Category
- C#
- Title
- unity how to tell when a gameobject is colliding
- Category
- C#
- Title
- what is the or symbol in C#
- Category
- C#
- Title
- linq c# or
- Category
- C#
- Title
- The type or namespace name 'Scrollbar' could not be found
- Category
- C#
- Title
- unity coroutine
- Category
- C#
- Title
- radians to degree c#
- Category
- C#
- Title
- get last element of array c#
- Category
- C#
- Title
- c# datetime dd/mm/yyy hh:mm:ss
- Category
- C#
- Title
- what is a return statement C#
- Category
- C#
- Title
- how to disable a gameObject unity c#
- Category
- C#
- Title
- c# variable
- Category
- C#
- Title
- get hash c#
- Category
- C#
- Title
- unity vector3 smoothdamp not reaching target
- Category
- C#
- Title
- linq foreach c#
- Category
- C#
- Title
- bool toggle unity c#
- Category
- C#
- Title
- how to select time and date in datetimepicker in c#
- Category
- C#
- Title
- validating file upload asp.net core mvc
- Category
- C#
- Title
- unity ai wander script
- Category
- C#
- Title
- unity if gameobject exists
- Category
- C#
- Title
- c# rsa example
- Category
- C#
- Title
- HashSet C# append
- Category
- C#
- Title
- converting letter to ascii
- Category
- C#
- Title
- unity how to get y value
- Category
- C#
- Title
- use newtonsoft json to clone object
- Category
- C#
- Title
- c# convert list to string
- Category
- C#
- Title
- C# graph api upload file one drive
- Category
- C#
- Title
- c# store generic type without arguments
- Category
- C#
- Title
- unity access child
- Category
- C#
- Title
- membership get user id
- Category
- C#
- Title
- how to create a list in c# unity
- Category
- C#
- Title
- c# remove character from string at index
- Category
- C#
- Title
- c# discord bot
- Category
- C#
- Title
- c# warning CS0108
- Category
- C#
- Title
- unity onclick addlistener
- Category
- C#
- Title
- unity rotate object relative to camera
- Category
- C#
- Title
- or in unity
- Category
- C#
- Title
- c# creating exceptions
- Category
- C#
- Title
- c# number suffixes
- Category
- C#
- Title
- unity simple fps controller
- Category
- C#
- Title
- how to get component in unity c#
- Category
- C#
- Title
- get web config key value in c# razor view
- Category
- C#
- Title
- object escape player unity
- Category
- C#
- Title
- clear combobox c#
- Category
- C#
- Title
- math.pow in C# using loop
- Category
- C#
- Title
- how to populate listbox using list<t> c#
- Category
- C#