stillbet.blogg.se

How to make a superscript for negative x
How to make a superscript for negative x









how to make a superscript for negative x

how to make a superscript for negative x

Any nonzero number raised by the exponent 0 is 1 one interpretation of these powers is as.Any number raised by the exponent 1 is the number itself.Generally, the special case Rules for Exponentiation from What is the biggest number/biggest precision the Result must be able to hold?

how to make a superscript for negative x

#HOW TO MAKE A SUPERSCRIPT FOR NEGATIVE X CODE#

Should this code work for Negative Bases? Should this code work for Negative Exponents? Okay, I think we can say to even remotely answer that: We. Public static string Power(int number, int power)Ĭonsole.WriteLine("", x, y, Power(x, y)) String desc = "\"How to make a program x^n in C# ?\"" Ĭonsole.WriteLine("\r\n" + desc + "\r\n") Same thing for "number" equal to zero when "power" is any negative value (result is "Infinity").Īlong those same lines, I would not normally return a string type from this method, but I threw this together quickly as a console application for demonstration purposes, and wanted to handle the "Infinity" and "Undefined" cases right there along with the You can even simplify it somewhat because you are (apparently) creating a GUI-based application, and therefore can do some validation before calling the method.įor example, if the user enters a zero for "number" and a zero for "power" you could just set the result text to "Undefined" without calling the method. Try running this console application to see if its Power() method meets your needs.











How to make a superscript for negative x