Hypotenuse using Pythagoras theorem c^2 =(a^2 + b^2) in c#.

 using Pythagoras theorem:

 CODE:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace simple_calculator

{class Program

    { static void Main(string[] args)

        {  DateTime dt = DateTime.Now;

            Console.WriteLine("{0}",dt);

            double a, b;

            Console.WriteLine("Enter your first value");

            a = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("Enter your second value");

            b = Convert.ToDouble(Console.ReadLine());

            double c = Math.Sqrt(Math.Pow(a,2)+Math.Pow(b,2));

            Console.WriteLine("Using pythagoras theorem:{0}",c);

 

        }

     }

 }

Output:



Comments

Popular posts from this blog

Vertical and Reverse Paramid in c# using loop.

Calculator in c# using Static Methods

Calculator in c# using Method void method