using   System;
using   System.Collections.Generic;
using   System.Linq;
using   System.Text;
using   System.IO;

namespace ConsoleApplication20
{
    class triangle
    {
        float bas;
        float perp;
        //float getperp;
        //float getbase;
        double area;
        double hypotnuse;
        public void setbase(float newvalue)
        {
            //Console.WriteLine("enter the first value?");
            //bas=Convert.ToSingle(Console.ReadLine());
            bas = newvalue;


         }
         public float getbase()
         {
             Console.WriteLine("enter the value of base?");
             bas = Convert.ToSingle(Console.ReadLine());

             return bas;
         }
         public void setperp(float newvalue)
         {
             perp = newvalue;

         }
         public float getperp()
         {
             Console.WriteLine("enter the value of perpendicular?");
             perp = Convert.ToSingle(Console.ReadLine());
             return perp;

         }
         public double getarea()
         {
             area = 0.5 * bas * perp;
             return area;


         }
         public double gethypotneus()
         {
             hypotnuse = Math.Sqrt((bas * bas) + (perp * perp));

              return hypotnuse;
         }


    }
    class Program
    {
        static void Main(string[] args)
        {
            triangle tr = new triangle();
tr.getperp();
            tr.getbase();
            tr.gethypotneus();
            tr.getarea();
            Console.WriteLine("Hypotnuse={0}", tr.gethypotneus());
            Console.WriteLine("Area = {0}", tr.getarea());
        }
    }
}

Triangle

  • 1.
    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication20 { class triangle { float bas; float perp; //float getperp; //float getbase; double area; double hypotnuse; public void setbase(float newvalue) { //Console.WriteLine("enter the first value?"); //bas=Convert.ToSingle(Console.ReadLine()); bas = newvalue; } public float getbase() { Console.WriteLine("enter the value of base?"); bas = Convert.ToSingle(Console.ReadLine()); return bas; } public void setperp(float newvalue) { perp = newvalue; } public float getperp() { Console.WriteLine("enter the value of perpendicular?"); perp = Convert.ToSingle(Console.ReadLine()); return perp; } public double getarea() { area = 0.5 * bas * perp; return area; } public double gethypotneus() { hypotnuse = Math.Sqrt((bas * bas) + (perp * perp)); return hypotnuse; } } class Program { static void Main(string[] args) { triangle tr = new triangle();
  • 2.
    tr.getperp(); tr.getbase(); tr.gethypotneus(); tr.getarea(); Console.WriteLine("Hypotnuse={0}", tr.gethypotneus()); Console.WriteLine("Area = {0}", tr.getarea()); } } }