Okay, I wrote a simple program that will churn out the square root of a given integer. There are just two small problems.
Error one says } expected even though all of my brackets are closed
Error two says Type or namespace definition, or end-of-file expected. Not entirely sure what this one is.
#region Using directives
using System;
using System.Text;
#endregion
namespace form1
{
class app
{
static void Main()
{
int target;
Console.WriteLine("Please type in your square. (integers only)");
target = Convert.ToInt32(Console.ReadLine()); /*convert target to user's choice of number*/
double guess = target/4;
Console.WriteLine("The square root of {0} is {1}.", target, Square(guess));_ //error 1
static double Square(double guess)
{
while(guess*guess != target)
{guess = (target / guess + guess) / 2;
Console.WriteLine("{0}", guess);
}
return guess;
}//end of Square
}//end of Main
}//end of class app
}//end of name form1 error 2
EDIT: Thanks. It works perfectly.