Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Retangulo ret = new Retangulo();

            Console.WriteLine("Entre a largura e altura do retângulo: ");

            ret.Largura = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
            ret.Altura  = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

            Console.WriteLine("AREA = " + ret.Area().ToString("F2", CultureInfo.InvariantCulture));
            Console.WriteLine("PERIMETRO = " + ret.Perimetro().ToString("F2", CultureInfo.InvariantCulture));
            Console.WriteLine("DIAGONAL = " + ret.Diagonal().ToString("F2", CultureInfo.InvariantCulture));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Digite a largura e altura do retângulo: ");
            double Largura = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
            double Altura  = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

            double area = Retangulo.Area(Largura, Altura);
            double per  = Retangulo.Perimetro(Largura, Altura);
            double dia  = Retangulo.Diagonal(Largura, Altura);

            Console.WriteLine("AREA = " + area.ToString("F2", CultureInfo.InvariantCulture));
            Console.WriteLine("PERÍMETRO = " + per.ToString("F2", CultureInfo.InvariantCulture));
            Console.WriteLine("DIAGONAL = " + dia.ToString("F2", CultureInfo.InvariantCulture));
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Retangulo H, B;

            H = new Retangulo();


            H.h = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
            H.b = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);

            Console.WriteLine("Area  = " + H.Area().ToString("F2", CultureInfo.InvariantCulture));

            Console.WriteLine("Perimetro  = " + H.Perimetro().ToString("F2", CultureInfo.InvariantCulture));

            Console.WriteLine("Diagonal = " + H.Diagonal().ToString("F2", CultureInfo.InvariantCulture));

            Console.ReadLine();
        }