double r; double area, circum; StreamReader Str = new StreamReader("My_File.txt"); //Path of file while (Str.Peek() > -1) { r = double.Parse(Str.ReadLine()); area = Math.Round( (r*r*22)/7,4);
circum = Math.Round((2 * 22 * r) / 7,4);
Console.WriteLine("Redius is {0} and Area is={1} and Circum is={2}", r, area, circum);
} Console.ReadLine();
this is example for console application .
Note: your file must be in the debug folder of your console application........
Console.WriteLine("For the circle radius of {0}, Here are the computed values Area:{1}, Circumference:{2}", circleRad, FindArea(circleRad), FindCircumference(circleRad));
Pankaj Kumar ChoudharyPosted May 18, 2015, 9:00 PM
double area, circum;
StreamReader Str = new StreamReader("My_File.txt"); //Path of file
while (Str.Peek() > -1)
{
r = double.Parse(Str.ReadLine());
area = Math.Round( (r*r*22)/7,4);
circum = Math.Round((2 * 22 * r) / 7,4);
Console.WriteLine("Redius is {0} and Area is={1} and Circum is={2}", r, area, circum);
}
Console.ReadLine();
Sai BagewadiPosted May 18, 2015, 8:58 PM