h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Square Root Calculation in C#.Net

Declaration part:
public static string strvalue;


public static stringres;

Function/Method:
#region Square Root 
      public static string  squareRoot(double fv, double sv)
      {
          double Result;
         
          for (int idx = 1; idx < sv+1; idx++)
          {
              if (idx == 1)
              {
                  Result = Math.Pow(fv, idx);
                  res = Convert.ToString(Result);
              }
              else if (idx >  1)
              {
                  Result = Math.Pow(fv, idx);
                  res = res  + "," + Convert.ToString(Result);
              }
          }
          strvalue =res;
          return strvalue;
      }
      #endregion Square Root
 
Call function in Your Application : 
string str = squareRoot(2, 10);
MessageBox.Show(str);
 

No comments:

Post a Comment