Saturday, January 9, 2016

Circle area calculator

Written by C#.


using System.IO;
using System;
using System.Math;
class Program
{
    static void Main()
    {
        string radius = Console.ReadLine();
        long radius2;
   
            if(long.TryParse(radius, out radius2) == false)
            {
                Console.WriteLine("Not appropriate number.");
                return;
            }
   
       
        long diameter = radius2 * 2;
        double radius3 = radius2;
        double areaOfCircle = radius3 * radius3 * Math.PI;
   
        Console.WriteLine("Diameter: " + diameter);
        Console.WriteLine("The area of circle: " + areaOfCircle);
    }
}