i tried searching for it for hours but cant find anything.

Dani AI

Generated

The phrase "square foot" is ambiguous in this context. "Square foot" normally means an area unit (ft²) — you find it by multiplying length by width — while "square root" is the mathematical operation that returns the value which, when squared, gives the original number. likely meant one of those; pointed you toward .NET's System.Math (useful for square-root and power functions), and noted this thread was a duplicate.

If you meant square footage (area in square feet): measure both dimensions in feet and multiply. Example: a 12 ft by 10 ft room has 12 * 10 = 120 square feet. In code (C#):

double lengthFt = 12.0;
double widthFt  = 10.0;
double areaSqFt = lengthFt * widthFt; // 120.0

If you meant the square root of a number (common when people say "square of a number" or confuse terms), use the language math functions. In C#:

double n = 25.0;
double root = Math.Sqrt(n);        // 5.0
double squared = n * n;           // 625.0
double rootAlt = Math.Pow(n, 0.5); // same as Math.Sqrt

Troubleshooting and tips:

  • For integer inputs consider types: use double for fractional results and cast/round if you need an integer result.
  • Math.Sqrt returns NaN for negative real inputs; use complex numbers (System.Numerics.Complex) if you want complex roots.
  • To compute arbitrary powers use Math.Pow(x, y); for squaring prefer x * x for speed and accuracy.
  • If you were searching for docs, 's pointer to System.Math is the right direction — look for Math.Sqrt, Math.Pow, and simple multiplication depending on whether you mean root, power, or area.

Recommended Answers

All 2 Replies

Here is a link to the MSDN docs for the System.Math class. Take a look and see if there is any method in there that can help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.